fix some encoding problems when looking for plugin config with non-ascii chars in path. Fixes #7015

This commit is contained in:
Yann Leboulanger 2011-10-23 18:55:14 +02:00
parent 6eedbf6e10
commit 6a2d835eab
1 changed files with 4 additions and 3 deletions

View File

@ -142,10 +142,11 @@ def parseOpts():
config_path_ = a config_path_ = a
return profile_, config_path_ return profile_, config_path_
import locale
profile, config_path = parseOpts() profile, config_path = parseOpts()
config_path = unicode(config_path, locale.getpreferredencoding())
del parseOpts del parseOpts
import locale
profile = unicode(profile, locale.getpreferredencoding()) profile = unicode(profile, locale.getpreferredencoding())
import common.configpaths import common.configpaths
@ -155,8 +156,8 @@ common.configpaths.gajimpaths.init_profile(profile)
del profile del profile
if os.name == 'nt': if os.name == 'nt':
plugins_locale_dir = str(os.path.join(common.configpaths.gajimpaths[ plugins_locale_dir = os.path.join(common.configpaths.gajimpaths[
'PLUGINS_USER'], 'locale')) 'PLUGINS_USER'], 'locale').encode(locale.getpreferredencoding())
libintl.bindtextdomain('gajim_plugins', plugins_locale_dir) libintl.bindtextdomain('gajim_plugins', plugins_locale_dir)
libintl.bind_textdomain_codeset('gajim_plugins', 'UTF-8') libintl.bind_textdomain_codeset('gajim_plugins', 'UTF-8')