Mailinglist Archive: opensuse-buildservice (312 mails)

< Previous Next >
Re: [opensuse-buildservice] osc umlaut problem
  • From: Susanne Oberhauser <froh@xxxxxxxxxx>
  • Date: Fri, 03 Jul 2009 13:24:59 +0200
  • Message-id: <s2i7hyq3t6c.fsf@xxxxxxxxxxxxx>
Michal Čihař <michal@xxxxxxxxx> writes:

There is thre fixes to this:

1. we enable in syte.py the use of the locale setting

Problem with this is that you will most likely break applications which
do rely on default settings.

yes.

2. we work around the IMNSHO braindead disablement of
"setdefaultencoding":

import sys, locale
reload(sys)
sys.setdefaultencoding(locale.getdefaultlocale()[1])

3. We scatter explicit unicode awareness to every place we possibly
handle unicode strings strings.


I *strongly* opt for #1 or #2. #3 is just so plain inelegant, I refuse
to do that. It's like checking return codes after exceptions have been
invented.

4. Wait for python 3.0 :-).

ok, that means #2 for now, right?


1 froh@byron:/tmp $ rcsdiff -u /usr/bin/osc
===================================================================
RCS file: /usr/bin/osc,v
retrieving revision 1.1
diff -u -r1.1 /usr/bin/osc
--- /usr/bin/osc 2009/07/03 11:20:56 1.1
+++ /usr/bin/osc 2009/07/03 11:22:39
@@ -3,7 +3,14 @@
# this wrapper exists so it can be put into /usr/bin, but still allows the
# python module to be called within the source directory during development

-import sys
+
+import sys, locale
+# this is a hack to make osc work as expected with utf-8 characters, no matter
+# how site.py is set...
+reload(sys)
+sys.setdefaultencoding(locale.getdefaultlocale()[1])
+del sys.setdefaultencoding
+
from osc import commandline
from osc import babysitter


This fixes the problem for me.


S.
--
Susanne Oberhauser +49-911-74053-574 SUSE -- a Novell Business
OPS Engineering Maxfeldstraße 5
Processes and Infrastructure Nürnberg
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >
List Navigation
Follow Ups