[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/texi2any.pl [MS-Windows: If loading I18N::La
From: |
Gavin D. Smith |
Subject: |
branch master updated: * tp/texi2any.pl [MS-Windows: If loading I18N::Langinfo doesn't work, then get codepage with GetACP() using Win32::API module. |
Date: |
Sun, 23 Oct 2022 04:51:44 -0400 |
This is an automated email from the git hooks/post-receive script.
gavin pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 558d38ce61 * tp/texi2any.pl [MS-Windows: If loading I18N::Langinfo
doesn't work, then get codepage with GetACP() using Win32::API module.
558d38ce61 is described below
commit 558d38ce6143d9b093fe6bac3550d3fb185cb7a4
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Oct 23 09:51:36 2022 +0100
* tp/texi2any.pl [MS-Windows: If loading I18N::Langinfo doesn't
work, then get codepage with GetACP() using Win32::API module.
---
ChangeLog | 8 +++++++-
tp/texi2any.pl | 22 ++++++++++++++++++----
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9f7ba6b46e..7da5cef17d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-10-23 Eli Zaretskii <eliz@gnu.org>, and
+ Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/texi2any.pl [MS-Windows: If loading I18N::Langinfo doesn't
+ work, then get codepage with GetACP() using Win32::API module.
+
2022-10-22 Gavin Smith <gavinsmith0123@gmail.com>
* tp/Texinfo/XS/XSParagraph.xs,
@@ -38,7 +44,7 @@
2022-10-22 Patrice Dumas <pertusus@free.fr>
- * ext/tex4ht.pm (tex4ht_process): sort formats for processing order
+ * tp/ext/tex4ht.pm (tex4ht_process): sort formats for processing order
to get a more reproducible output and messages order.
2022-10-22 Patrice Dumas <pertusus@free.fr>
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index d6061bd8f0..fa2cc88c72 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -25,8 +25,6 @@ require 5.00405;
use strict;
-# to determine the locale encoding
-use I18N::Langinfo qw(langinfo CODESET);
# to decode command line arguments
use Encode qw(decode encode find_encoding);
# for file names portability
@@ -297,8 +295,24 @@ if ($texinfo_dtd_version eq '@' . 'TEXINFO_DTD_VERSION@') {
# the encoding used to decode command line arguments, and also for
# file names encoding, perl is expecting sequences of bytes, not unicode
# code points.
-my $locale_encoding = langinfo(CODESET);
-$locale_encoding = undef if ($locale_encoding eq '');
+my $locale_encoding;
+
+eval 'require I18N::Langinfo';
+if (!$@) {
+ $locale_encoding = I18N::Langinfo::langinfo(I18N::Langinfo::CODESET());
+ $locale_encoding = undef if ($locale_encoding eq '');
+}
+
+if (!defined($locale_encoding) and $^O eq 'MSWin32') {
+ eval 'require Win32::API';
+ if (!$@) {
+ Win32::API::More->Import("kernel32", "int GetACP()");
+ my $CP = GetACP();
+ if (defined($CP)) {
+ $locale_encoding = 'cp'.$CP;
+ }
+ }
+}
# Used in case it is not hardcoded in configure and for standalone perl module
$texinfo_dtd_version = $configured_version
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/texi2any.pl [MS-Windows: If loading I18N::Langinfo doesn't work, then get codepage with GetACP() using Win32::API module.,
Gavin D. Smith <=