use locale.getpreferredencoding() instead of sys.getfsencoding in decode_string

This commit is contained in:
Nikos Kouremenos 2006-11-02 13:42:51 +00:00
parent c494b7f5b9
commit fa20b21507
1 changed files with 2 additions and 1 deletions

View File

@ -17,6 +17,7 @@
## ##
import sre import sre
import locale
import os import os
import subprocess import subprocess
import urllib import urllib
@ -553,7 +554,7 @@ def decode_string(string):
if isinstance(string, unicode): if isinstance(string, unicode):
return string return string
# by the time we go to iso15 it better be the one else we show bad characters # by the time we go to iso15 it better be the one else we show bad characters
encodings = (sys.getfilesystemencoding(), 'utf-8', 'iso-8859-15') encodings = (locale.getpreferredencoding(), 'utf-8', 'iso-8859-15')
for encoding in encodings: for encoding in encodings:
try: try:
string = string.decode(encoding) string = string.decode(encoding)