On Tue, Jul 17, 2012 at 07:39:44AM +0000, Florian Obser wrote:
> Hi,
> 
> I get the following stack trace:
> 
> Exception in thread Thread-48:
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.7/threading.py", line 551, in __bootstrap_inner
>     self.run()
>   File "/usr/local/lib/python2.7/threading.py", line 504, in run
>     self.__target(*self.__args, **self.__kwargs)
>   File "/usr/local/share/gajim/src/gui_interface.py", line 2949, in 
> thread_function
>     output = func(*func_args)
>   File "/usr/local/share/gajim/src/common/connection.py", line 293, in 
> encrypt_thread
>     return self.gpg.encrypt(msg, [keyID], always_trust)
>   File "/usr/local/share/gajim/src/common/gpg.py", line 50, in encrypt
>     always_trust=always_trust, passphrase=self.passphrase)
>   File "/usr/local/share/gajim/src/common/gnupg.py", line 646, in encrypt
>     data = _make_binary_stream(data, self.encoding)
>   File "/usr/local/share/gajim/src/common/gnupg.py", line 148, in 
> _make_binary_stream
>     s = s.encode(encoding)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 
> 1: ordinal not in range(128)
> 

Seems like a perfectly sensible failure mode to me, see below.

> This is on
> OpenBSD 5.2-beta (GENERIC) #257: Wed Jul 11 11:32:34 MDT 2012
>     t...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
> 
> with Information for inst:gajim-0.15p3
> 
> The message is not send, not added to the log and not added to the
> local chat window.
> 
> I found two workarounds: Disable "OpenPGP encryption" (hm, yeah, not
> going to happen) or start gajim with LANG set, i.e. LANG=en_US.UTF-8 gajim
> LANG is unset on my workstation.

Why don't you use the UTF-8 locale if you want to use UTF-8?
 
> I know this worked in 4.9, I know it's broken in a 5.1-current
> snapshot at or around 25th of may, there is anecdotal evidence that it
> used to work on 5.1-current in the february to march timeframe.

OpenBSD's libc used to default to latin1 semantics until september 2011.
Since then, it's been using ASCII by default, and you have to configure
a locale if you want anything more than ASCII.
See http://marc.info/?l=openbsd-cvs&m=131668243124387&w=2
and http://marc.info/?l=openbsd-cvs&m=130186491102931&w=2
This was also mentioned on current.html at the time but that entry
has since been shifted out.

I am not sure if python follows semantics provided by libc,
though that would definitely make sense. If it doesn't then
you might be obversing a behaviour change in python as well,
since it was probably upgraded during the same time frame.
Maybe the way python selects encoding modules has changed?

However, I don't see how this behaviour is wrong.

You should be configuring the correct locale for your desired character set.
There is nothing wrong with doing this just for one application if you
don't want every application to use UTF-8.

Reply via email to