Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

added 13 characters in body
Source Link
Elie G.
  • 1.8k
  • 1
  • 25
  • 42

Here's the content of my-test.mo in UTF-8:

ޒ , < H I 3 V 7 test-message Project-Id-Version: my-package v0.0.1
Report-Msgid-Bugs-To: 
PO-Revision-Date: 2025年11月25日 17:58-0500
Last-Translator: Automatically generated
Language-Team: none
Language: fr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Plural-Forms: nplurals=2; plural=(n > 1);
 a à e é è ê ë i î ï o ô ö u ù û ü c ç n ñ 

Update

Update

Here's the content of my-test.mo in UTF-8:

ޒ , < H I 3 V 7 test-message Project-Id-Version: my-package v0.0.1
Report-Msgid-Bugs-To: 
PO-Revision-Date: 2025年11月25日 17:58-0500
Last-Translator: Automatically generated
Language-Team: none
Language: fr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Plural-Forms: nplurals=2; plural=(n > 1);
 a à e é è ê ë i î ï o ô ö u ù û ü c ç n ñ 

Update

added 13 characters in body
Source Link
Elie G.
  • 1.8k
  • 1
  • 25
  • 42
file --mime ./fr.po # output: ./fr.po: text/x-po; charset=utf-8
msgfmt -o -output-file='/usr/share/locale/fr/LC_MESSAGES/my-test.momo' ./fr.po
export TEXTDOMAINDIR=/usr/share/locale
export TEXTDOMAIN=my-test
export LANG=fr_CA.UTF-8
export LC_ALL=fr_CA.UTF-8
# The following command works as intended and prints this:
# a à e é è ê ë i î ï o ô ö u ù û ü c ç n ñ
gettext test-message
# However if I use the same command within a string or in a pipeline I get this:
# a しろいしかく e しろいしかく しろいしかく しろいしかく しろいしかく i しろいしかく しろいしかく o しろいしかく しろいしかく u しろいしかく しろいしかく しろいしかく c しろいしかく n
printf "$(gettext test-message)"
echo "$(gettext test-message)"
gettext test-message | cat
cat <(gettext test-message)
####
gettext test-message > out.txt
cat out.txt # output: a しろいしかく e しろいしかく しろいしかく しろいしかく しろいしかく i しろいしかく しろいしかく o しろいしかく しろいしかく u しろいしかく しろいしかく しろいしかく c しろいしかく n
file --mime out.txt # output: out.txt: text/plain; charset=iso-8859-1
file --mime ./fr.po # output: ./fr.po: text/x-po; charset=utf-8
msgfmt -o /usr/share/locale/fr/LC_MESSAGES/my-test.mo ./fr.po
export TEXTDOMAINDIR=/usr/share/locale
export TEXTDOMAIN=my-test
export LANG=fr_CA.UTF-8
export LC_ALL=fr_CA.UTF-8
# The following command works as intended and prints this:
# a à e é è ê ë i î ï o ô ö u ù û ü c ç n ñ
gettext test-message
# However if I use the same command within a string or in a pipeline I get this:
# a しろいしかく e しろいしかく しろいしかく しろいしかく しろいしかく i しろいしかく しろいしかく o しろいしかく しろいしかく u しろいしかく しろいしかく しろいしかく c しろいしかく n
printf "$(gettext test-message)"
echo "$(gettext test-message)"
gettext test-message | cat
cat <(gettext test-message)
####
gettext test-message > out.txt
cat out.txt # output: a しろいしかく e しろいしかく しろいしかく しろいしかく しろいしかく i しろいしかく しろいしかく o しろいしかく しろいしかく u しろいしかく しろいしかく しろいしかく c しろいしかく n
file --mime out.txt # output: out.txt: text/plain; charset=iso-8859-1
file --mime ./fr.po # output: ./fr.po: text/x-po; charset=utf-8
msgfmt --output-file='/usr/share/locale/fr/LC_MESSAGES/my-test.mo' ./fr.po
export TEXTDOMAINDIR=/usr/share/locale
export TEXTDOMAIN=my-test
export LANG=fr_CA.UTF-8
export LC_ALL=fr_CA.UTF-8
# The following command works as intended and prints this:
# a à e é è ê ë i î ï o ô ö u ù û ü c ç n ñ
gettext test-message
# However if I use the same command within a string or in a pipeline I get this:
# a しろいしかく e しろいしかく しろいしかく しろいしかく しろいしかく i しろいしかく しろいしかく o しろいしかく しろいしかく u しろいしかく しろいしかく しろいしかく c しろいしかく n
printf "$(gettext test-message)"
echo "$(gettext test-message)"
gettext test-message | cat
cat <(gettext test-message)
####
gettext test-message > out.txt
cat out.txt # output: a しろいしかく e しろいしかく しろいしかく しろいしかく しろいしかく i しろいしかく しろいしかく o しろいしかく しろいしかく u しろいしかく しろいしかく しろいしかく c しろいしかく n
file --mime out.txt # output: out.txt: text/plain; charset=iso-8859-1
deleted 5 characters in body
Source Link
Elie G.
  • 1.8k
  • 1
  • 25
  • 42

I have found a workaround using iconv. For example:

I have found a workaround using iconv. For example:

I found a workaround using iconv. For example:

workaround
Source Link
Elie G.
  • 1.8k
  • 1
  • 25
  • 42
Loading
Source Link
Elie G.
  • 1.8k
  • 1
  • 25
  • 42
Loading
lang-bash

AltStyle によって変換されたページ (->オリジナル) /