texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Translations.pm (gdt): have the gett


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Translations.pm (gdt): have the gettext framework convert translated strings to UTF-8, and decode from UTF-8 to internal perl encoding.
Date: Sun, 06 Aug 2023 13:57:34 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 76169f89e4 * tp/Texinfo/Translations.pm (gdt): have the gettext 
framework convert translated strings to UTF-8, and decode from UTF-8 to 
internal perl encoding.
76169f89e4 is described below

commit 76169f89e457ea9e370db8fa16824a03cd148106
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Aug 6 21:57:23 2023 +0200

    * tp/Texinfo/Translations.pm (gdt): have the gettext framework convert
    translated strings to UTF-8, and decode from UTF-8 to internal perl
    encoding.
---
 ChangeLog                  |  6 ++++++
 tp/Texinfo/Translations.pm | 28 ++++++++++++++++++++--------
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5a258eb381..9ca6cb67c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-08-06  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Translations.pm (gdt): have the gettext framework convert
+       translated strings to UTF-8, and decode from UTF-8 to internal perl
+       encoding.
+
 2023-08-06  Patrice Dumas  <pertusus@free.fr>
 
        * po_document/LINGUAS, po_document/pl.iso-8859-2.po, tp/Makefile.am
diff --git a/tp/Texinfo/Translations.pm b/tp/Texinfo/Translations.pm
index d9fbb98281..92837fb1ba 100644
--- a/tp/Texinfo/Translations.pm
+++ b/tp/Texinfo/Translations.pm
@@ -139,14 +139,26 @@ sub gdt($$;$$$$)
     $encoding = $DEFAULT_ENCODING;
     $perl_encoding = $DEFAULT_PERL_ENCODING;
   }
-  Locale::Messages::bind_textdomain_codeset($strings_textdomain, $encoding)
-    if ($encoding and $encoding ne 'us-ascii');
-  if (!($encoding and $encoding eq 'us-ascii')) {
-    if ($perl_encoding) {
-      Locale::Messages::bind_textdomain_filter($strings_textdomain,
-        \&_decode_i18n_string, $perl_encoding);
-    }
-  }
+  Locale::Messages::bind_textdomain_codeset($strings_textdomain, 'UTF-8');
+  Locale::Messages::bind_textdomain_filter($strings_textdomain,
+                          \&_decode_i18n_string, 'UTF-8');
+  # Previously we used the encoding used for input or output to be converted
+  # to and then decoded to the perl internal encoding.  But it should be safer
+  # to use UTF-8 as we cannot know in advance if the encoding actually used
+  # is compatible with the specified encoding, while it should be compatible
+  # with UTF-8.  If there are actually characters that cannot be encoded in the
+  # output encoding issues will still show up when encoding to output, though.
+  # Should be more similar with code used in XS modules, too.
+  # As a side note, the best would have been to directly decode using the
+  # charset used in the po/gmo files, but it does not seems to be available.
+  #Locale::Messages::bind_textdomain_codeset($strings_textdomain, $encoding)
+  #  if ($encoding and $encoding ne 'us-ascii');
+  #if (!($encoding and $encoding eq 'us-ascii')) {
+  #  if ($perl_encoding) {
+  #    Locale::Messages::bind_textdomain_filter($strings_textdomain,
+  #      \&_decode_i18n_string, $perl_encoding);
+  #  }
+  #}
 
   my @langs = ($lang);
   if ($lang =~ /^([a-z]+)_([A-Z]+)/) {



reply via email to

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