texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[7421] remove use locale pragma


From: gavinsmith0123
Subject: [7421] remove use locale pragma
Date: Thu, 29 Sep 2016 20:22:40 +0000 (UTC)

Revision: 7421
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7421
Author:   gavin
Date:     2016-09-29 20:22:39 +0000 (Thu, 29 Sep 2016)
Log Message:
-----------
remove use locale pragma

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Convert/HTML.pm
    trunk/tp/Texinfo/Convert/Plaintext.pm
    trunk/tp/Texinfo/Structuring.pm

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-09-28 20:06:19 UTC (rev 7420)
+++ trunk/ChangeLog     2016-09-29 20:22:39 UTC (rev 7421)
@@ -1,3 +1,15 @@
+2016-09-29  Gavin Smith  <address@hidden>
+
+       * tp/Texinfo/Convert/HTML.pm,
+       * tp/Texinfo/Convert/Plaintext.pm,
+       * tp/Texinfo/Structuring.pm: Remove 'use locale' directives for 
+       older Perl versions.  There were subtle differences,
+       for example whether German eszet uppercased to "SS" or
+       itself.  It would also need the locale to be set and restored 
+       everywhere it mattered.
+       * tp/Texinfo/Structuring.pm (_do_index_strings): Call 
+       utf8::upgrade on the index entry sort key.
+
 2016-09-28  Gavin Smith  <address@hidden>
 
        * tp/Texinfo/Parser.pm: Remove commented out "use POSIX" 

Modified: trunk/tp/Texinfo/Convert/HTML.pm
===================================================================
--- trunk/tp/Texinfo/Convert/HTML.pm    2016-09-28 20:06:19 UTC (rev 7420)
+++ trunk/tp/Texinfo/Convert/HTML.pm    2016-09-29 20:22:39 UTC (rev 7421)
@@ -26,17 +26,9 @@
 # See 'The "Unicode Bug"' under 'perlunicode' man page.  This means
 # that regular expressions will treat characters 128-255 in a Perl string
 # the same regardless of whether the string is using a UTF-8 encoding.
-# If the Perl version is too old for "use feature 'unicode_strings';",
-# attempt to get the same result with 'use locale;' with a Latin-1 locale.
-use POSIX qw(locale_h);
-BEGIN {
-  if ($] >= 5.012) {
-    require feature; feature->import('unicode_strings');
-  } else {
-    setlocale(LC_CTYPE, "en_US");
-    require locale; locale->import();
-  }
-}
+#  For older Perls, you can use utf8::upgrade on the strings, where the
+# difference matters.
+use if $] >= 5.012, feature => 'unicode_strings';
 
 use strict;
 

Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm       2016-09-28 20:06:19 UTC (rev 
7420)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm       2016-09-29 20:22:39 UTC (rev 
7421)
@@ -24,15 +24,7 @@
 use 5.00405;
 
 # See comment at start of HTML.pm
-use POSIX qw(locale_h);
-BEGIN {
-  if ($] >= 5.012) {
-    require feature; feature->import('unicode_strings');
-  } else {
-    setlocale(LC_CTYPE, "en_US");
-    require locale; locale->import();
-  }
-}
+use if $] >= 5.012, feature => qw(unicode_strings);
 
 use strict;
 

Modified: trunk/tp/Texinfo/Structuring.pm
===================================================================
--- trunk/tp/Texinfo/Structuring.pm     2016-09-28 20:06:19 UTC (rev 7420)
+++ trunk/tp/Texinfo/Structuring.pm     2016-09-29 20:22:39 UTC (rev 7421)
@@ -25,15 +25,7 @@
 use 5.00405;
 
 # See comment at start of HTML.pm
-use POSIX qw(locale_h);
-BEGIN {
-  if ($] >= 5.012) {
-    require feature; feature->import('unicode_strings');
-  } else {
-    setlocale(LC_CTYPE, "en_US");
-    require locale; locale->import();
-  }
-}
+use if $] >= 5.012, feature => 'unicode_strings';
 
 use strict;
 
@@ -2080,6 +2072,10 @@
                                  $entry->{'index_at_command'}),
                         $entry->{'command'}->{'line_nr'});
       }
+      # This avoids varying results depending on whether the string is
+      # represented internally in UTF-8.  See "the Unicode bug" in the
+      # "perlunicode" man page.
+      utf8::upgrade($entry->{'key'});
     }
   }
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]