1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-24 03:02:12 +01:00

Fix locale encoding extraction

Using locale.getdefaultlocale() for encoding detection breaks with
locales that use modifiers, such as de_DE@euro, or ca_ES@valencia.
Use locale.getpreferredencoding() instead, which should do the right
thing.
This commit is contained in:
Jordi Mallach 2012-08-06 09:29:59 +02:00 committed by Michal Čihař
parent 9446307c12
commit 9f35853216

View File

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