Skip to content
Snippets Groups Projects
Commit e07e4773 authored by Christophe Simonis's avatar Christophe Simonis
Browse files

[FIX] try to set the locale to utf8 before using the preferred encoding

lp bug: https://launchpad.net/bugs/322432 fixed

bzr revid: christophe@tinyerp.com-20090205100229-igxb3dnne8e34evg
parent 9c38a58c
Branches
Tags
No related merge requests found
......@@ -648,12 +648,16 @@ def trans_load_data(db_name, fileobj, fileformat, lang, strict=False, lang_name=
def resetlocale():
# locale.resetlocale is bugged with some locales.
loc = locale.getdefaultlocale()[0]
enc = locale.getpreferredencoding()
ln = locale._build_localename((loc, enc))
try:
ln = locale._build_localename((loc, 'utf8'))
locale.setlocale(locale.LC_ALL, ln)
except locale.Error:
locale.setlocale(locale.LC_ALL, loc)
enc = locale.getpreferredencoding()
ln = locale._build_localename((loc, enc))
try:
locale.setlocale(locale.LC_ALL, ln)
except locale.Error:
locale.setlocale(locale.LC_ALL, loc)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment