[Top][All Lists]

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

Re: texinfo-6.8.90 pretest

From: Gavin Smith
Subject: Re: texinfo-6.8.90 pretest
Date: Sat, 22 Oct 2022 18:16:35 +0100

> Not for Windows, because Windows lacks the nl_langinfo function, for
> which this module is a think wrapper on Unix.
> AFAIU, on Windows this module is available only starting from v5.28.

Can we use LC_CTYPE, like:

diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index d6061bd8f0..8864ebeedc 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -26,7 +26,9 @@ require 5.00405;
 use strict;
 # to determine the locale encoding
-use I18N::Langinfo qw(langinfo CODESET);
+#use I18N::Langinfo qw(langinfo CODESET);
+use POSIX qw(setlocale LC_ALL LC_CTYPE);
 # to decode command line arguments
 use Encode qw(decode encode find_encoding);
 # for file names portability
@@ -297,7 +299,12 @@ 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);
+# my $locale_encoding = langinfo(CODESET);
+my $locale_encoding = POSIX::setlocale(LC_CTYPE);
+$locale_encoding =~ s/^[^.]*.//;
+$locale_encoding =~ s/@.*$//;
 $locale_encoding = undef if ($locale_encoding eq '');
 # Used in case it is not hardcoded in configure and for standalone perl module

If this works then we could switch to it and not use I18N::Langinfo at

reply via email to

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