diff --git a/lib/Biber/Internals.pm b/lib/Biber/Internals.pm index d96e83cce..d468196b0 100644 --- a/lib/Biber/Internals.pm +++ b/lib/Biber/Internals.pm @@ -1674,19 +1674,21 @@ sub _namestring { # The namepart is padded to the longest namepart in the ref # section as this is the only way to make sorting work # properly. The padding is spaces as this sorts before all - # glyphs but it also of variable weight and ignorable in + # glyphs but is also of variable weight and ignorable in # DUCET so we have to set U::C to variable=>'non-ignorable' # as sorting default so that spaces are non-ignorable $nps = normalise_string_sort(join('', $npistring->@*), $field); # pad all nameparts - $nps = sprintf("%-*s", $section->get_np_length("${namepart}-i"), $nps); + # have to NFC for the padding otherwise the glyph length calculations are wrong + $nps = NFD(sprintf("%-*s", $section->get_np_length("${namepart}-i"), NFC($nps))); } else { $nps = normalise_string_sort($npstring, $field); # pad all nameparts - $nps = sprintf("%-*s", $section->get_np_length($namepart), $nps); + # have to NFC for the padding otherwise the glyph length calculations are wrong + $nps = NFD(sprintf("%-*s", $section->get_np_length($namepart), NFC($nps))); } $kps .= $nps; } diff --git a/t/sorting.t b/t/sorting.t index 2d58fa5b6..a72397f10 100644 --- a/t/sorting.t +++ b/t/sorting.t @@ -73,9 +73,9 @@ my $lists3 = "IBM\x{10FFFD}"; my $lists4 = "IBM!HP\x{10FFFD}"; my $lists5 = 'IBM!HP!Sun!Sony'; my $dates1 = '1979,1,2000000,1980,4,8,1924,6,7,1924,7,9,1924,0002,5,192,2,3,1979,3,4,79,3,3'; -my $edtypeclass1 = 'redactor,Jaffé Philipp ,Loewenfeld Samuel KaltenbrunnerFerdinand Ewald Paul '; -my $prefix1 = 'mm,,Luzzatto Moshe Ḥayyim ,,,Lashon la-Ramḥal: u-vo sheloshah ḥiburim,2000,'; -my $diacritic1 = 'mm,,Hasan Alī ,al-Hasan ʿAlī ,Hasan Alī ,Some title,2000,'; +my $edtypeclass1 = 'redactor,Jaffé Philipp ,Loewenfeld Samuel KaltenbrunnerFerdinand Ewald Paul '; +my $prefix1 = 'mm,,Luzzatto Moshe Ḥayyim ,,,Lashon la-Ramḥal: u-vo sheloshah ḥiburim,2000,'; +my $diacritic1 = 'mm,,Hasan Alī ,al-Hasan ʿAlī ,Hasan Alī ,Some title,2000,'; my $labels = '2005,3,2'; my $sn1 = ''; my $snk1 = 'mm,,John John vonDoe Jr,,,0';