texinfo-commits
[Top][All Lists]
Advanced

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

[7419] use locale fallback for old perl


From: gavinsmith0123
Subject: [7419] use locale fallback for old perl
Date: Tue, 27 Sep 2016 20:46:56 +0000 (UTC)

Revision: 7419
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7419
Author:   gavin
Date:     2016-09-27 20:46:55 +0000 (Tue, 27 Sep 2016)
Log Message:
-----------
use locale fallback for old perl

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-24 18:53:34 UTC (rev 7418)
+++ trunk/ChangeLog     2016-09-27 20:46:55 UTC (rev 7419)
@@ -1,5 +1,14 @@
 2016-09-24  Gavin Smith  <address@hidden>
 
+       * tp/Texinfo/Convert/HTML.pm,
+       * tp/Texinfo/Convert/Plaintext.pm,
+       * tp/Texinfo/Structuring.pm: Test perl version and only
+       "use feature 'unicode_strings'" if perl version is at
+       least 5.012.  Otherwise, "use locale;" and try to set a
+       Latin-1 locale.
+
+2016-09-24  Gavin Smith  <address@hidden>
+
        * doc/texinfo-tex-test.texi (Fonts): More tests of fonts.  Add 
        section testing glyph commands.
 

Modified: trunk/tp/Texinfo/Convert/HTML.pm
===================================================================
--- trunk/tp/Texinfo/Convert/HTML.pm    2016-09-24 18:53:34 UTC (rev 7418)
+++ trunk/tp/Texinfo/Convert/HTML.pm    2016-09-27 20:46:55 UTC (rev 7419)
@@ -23,10 +23,20 @@
 
 use 5.00405;
 
-use feature 'unicode_strings';
 # 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();
+  }
+}
 
 use strict;
 

Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm       2016-09-24 18:53:34 UTC (rev 
7418)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm       2016-09-27 20:46:55 UTC (rev 
7419)
@@ -22,7 +22,18 @@
 package Texinfo::Convert::Plaintext;
 
 use 5.00405;
-use feature 'unicode_strings';
+
+# 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 strict;
 
 use Texinfo::Convert::Converter;

Modified: trunk/tp/Texinfo/Structuring.pm
===================================================================
--- trunk/tp/Texinfo/Structuring.pm     2016-09-24 18:53:34 UTC (rev 7418)
+++ trunk/tp/Texinfo/Structuring.pm     2016-09-27 20:46:55 UTC (rev 7419)
@@ -23,7 +23,18 @@
 package Texinfo::Structuring;
 
 use 5.00405;
-use feature 'unicode_strings';
+
+# 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 strict;
 
 # for debugging.  Also for index entries sorting.




reply via email to

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