[Reportbug-maint] Bug#539736: reportbug: --subject does not accept non-ASCII characters

Jakub Wilk ubanus at users.sf.net
Thu Aug 27 22:07:39 UTC 2009


* Sandro Tosi <morph at debian.org>, 2009-08-27, 21:52:
>>> what about setting
>>>
>>> import sys
>>> sys.setdefaultencoding('utf-8')
>>>
>>> at the beginning of bin/reportbug ?
>>
>> That would be totally wrong (even though the gtk module actually seems to be
>> doing something like this). Let me quote GvR[1]:
>
>So, what are you proposing?
>
>if the alternative is to encode/decode each string we have to print on
>screen because in 2009 there are still users not using utf8 shells,
>then I'm fine with this change and to deal with the fallback.

You missed my point. Setting default encoding in Python 2.x would be 
invalid even if the whole world were using UTF-8. That's why this 
function is absent from the sys module by default.

Issue with printing can be solved easily: just replace sys.stdout and 
sys.stderr with custom wrappers that encodes (with errors='replace') 
Unicode strings for you.

Side note: As long as a locale is supported by libc, it is not a user 
"fault" that he/she is using it. Keep in mind that not every piece of 
software in Debian support UTF-8 [1], so one could have a good reason to 
use a legacy encoding.

[1] In fact, even coreutils does not: 
http://bugs.debian.org/139861
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/91175

-- 
Jakub Wilk





More information about the Reportbug-maint mailing list