pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: math/gnumeric112 fails to build
Am 24.03.2019 um 14:44 schrieb Greg Troxel:
> File "/usr/pkg/bin/itstool", line 1065, in get_translated
> msgstr.encode('utf-8')))
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 97
I've reproduced the problem with python2.7. With python3.6 it doesn't
occur. There the error messages are successfully written to stderr.
Probably the encoding of sys.stderr is set to 'ascii'. When writing a
non-ASCII string to it, it fails. The msgstr from the first warning is
essentially u'...\xa0...'.
As wiz already pointed out, there is a workaround in
https://github.com/itstool/itstool/issues/22. Since it's just an error
message, I applied a similar workaround as there. In bin/itstool, I
simply replaced msgstr.encode('utf-8') with repr(msgstr).
Curiously itstool also crashes if I set the locale encoding to UTF-8:
cd math/gnumeric112
bmake
LC_ALL=en_US.UTF-8 itstool \
-m work/gnumeric-1.12.44/doc/cs/cs.mo \
work/gnumeric-1.12.44/doc/C/gnumeric.xml
It might be that the encoding of sys.stderr is the difference between
python2.7 and python3.6. On the other hand:
LC_ALL=C python2.7 -c \
'import sys; sys.stderr.write(unichr(160))'
=> fails
LC_ALL=en_US.UTF-8 python2.7 -c \
'import sys; sys.stderr.write(unichr(160))'
=> succeeds
Therefore I wonder why itstool doesn't show the same behavior. It fails
in all locales.
Roland
Home |
Main Index |
Thread Index |
Old Index