This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
avoid synthesizing locale names with newlines in them
authorTony Cook <tony@develop-help.com>
Tue, 23 Jul 2019 00:45:04 +0000 (10:45 +1000)
committerTony Cook <tony@develop-help.com>
Tue, 23 Jul 2019 01:15:56 +0000 (11:15 +1000)
while debugging some strange behaviour on Win32 I tried dumping
locale names in _trylocale() and saw names go past like:

sv_fi.15
          <-- newline added at the end
sv_fi.15
.UTF-8
sv_fi.15
.65001
sv_fi.15
.ACP
sv_fi.15
.OCP
sv_fi.15
.1252

t/loc_tools.pl

index beebd98..86d694d 100644 (file)
@@ -424,6 +424,7 @@ sub find_locales ($;$) {
         push @Data, <DATA>; close DATA;
 
         foreach my $line (@Data) {
         push @Data, <DATA>; close DATA;
 
         foreach my $line (@Data) {
+            chomp $line;
             my ($locale_name, $language_codes, $country_codes, $encodings) =
                 split /:/, $line;
             _my_diag(__FILE__ . ":" . __LINE__ . ": Unexpected syntax in '$line'")
             my ($locale_name, $language_codes, $country_codes, $encodings) =
                 split /:/, $line;
             _my_diag(__FILE__ . ":" . __LINE__ . ": Unexpected syntax in '$line'")