On Mon, 14 Sep 2015 18:25:26 +0300 Hleb Valoshka wrote:
> On 9/14/15, Hleb Valoshka <375gnu@gmail.com> wrote:
>
> > It looks like a ruby-gettext error, GNU gettext in such cases returns
> > original string (because LC_MESSAGES=C), but I should check docs for
> > gettext.
>
> ruby-locale, actually. Feel free to report bug against it.
Thanks a lot for looking into the issue, but there's one thing I am not
sure I get right: the original string only includes ASCII characters
and works fine with Unicode.width() .
Indeed, if I issue the following command:
$ LC_ALL=C locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C
$ LC_ALL=C apt-listbugs -v
0.1.17
everything seems to work as it should.
Also:
$ LANGUAGE='en_US:en' LC_ALL=C apt-listbugs -v
0.1.17
$ LANGUAGE='de_DE:de' LC_ALL=C apt-listbugs -v
0.1.17
work fine.
I only get into trouble when the translated string includes non-ASCII
UTF-8 characters and the LC_CTYPE is "C":
$ LANGUAGE='it_IT:it' LC_ALL='C' apt-listbugs -v
/usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:390:in `width': "\xC3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
from /usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:390:in `<class:SimpleViewer>'
from /usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:387:in `<class:Viewer>'
from /usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:381:in `<top (required)>'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/bin/apt-listbugs:349:in `<main>'
$ LANGUAGE='it_IT:it' LC_CTYPE='C' locale
LANG=en_US.UTF-8
LANGUAGE=it_IT:it
LC_CTYPE=C
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
$ LANGUAGE='it_IT:it' LC_CTYPE='C' apt-listbugs -v
/usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:390:in `width': "\xC3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
from /usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:390:in `<class:SimpleViewer>'
from /usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:387:in `<class:Viewer>'
from /usr/lib/ruby/vendor_ruby/aptlistbugs/logic.rb:381:in `<top (required)>'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/bin/apt-listbugs:349:in `<main>'
$ LANGUAGE='it_IT:it' locale
LANG=en_US.UTF-8
LANGUAGE=it_IT:it
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
$ LANGUAGE='it_IT:it' apt-listbugs -v
0.1.17
Hence, it seems to me that the trouble is not caused by the original
string, but by those translated strings that include non-ASCII UTF-8
characters and are somehow sent as non-UTF-8 non-pure-ASCII strings,
whenever LC_CTYPE=C ...
--
http://www.inventati.org/frx/
There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
GnuPG key fpr == CA01 1147 9CD2 EFDF FB82 3925 3E1C 27E1 1F69 BFFE
Attachment:
pgpRr0SVFE3j8.pgp
Description: PGP signature