Skip to content

Commit

Permalink
Fix locale encoding extraction
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Jordi Mallach authored and nijel committed Aug 6, 2012
1 parent 9446307 commit 9f35853
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions osc-wrapper.py
Expand Up @@ -11,9 +11,9 @@
# 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

Expand Down

0 comments on commit 9f35853

Please sign in to comment.