From 96de1729511b243944b84453b9ea0af2d497bc71 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 10 Sep 2010 21:31:25 +0200 Subject: [PATCH] Fix running Gajim under windows for users with non-ascii char in account name. Fixes #5852 --- src/common/zeroconf/connection_zeroconf.py | 5 ++++- src/plugins/plugin.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common/zeroconf/connection_zeroconf.py b/src/common/zeroconf/connection_zeroconf.py index 484b810a4..ed9acf725 100644 --- a/src/common/zeroconf/connection_zeroconf.py +++ b/src/common/zeroconf/connection_zeroconf.py @@ -48,6 +48,8 @@ from common.zeroconf import client_zeroconf from common.zeroconf import zeroconf from connection_handlers_zeroconf import * +import locale + class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf): def __init__(self, name): ConnectionHandlersZeroconf.__init__(self) @@ -105,7 +107,8 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf): 'zeroconf_email') if not self.username: - self.username = unicode(getpass.getuser()) + self.username = unicode(getpass.getuser(), + locale.getpreferredencoding()) gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, 'name', self.username) else: diff --git a/src/plugins/plugin.py b/src/plugins/plugin.py index 19ca1ce5e..c0b1b2033 100644 --- a/src/plugins/plugin.py +++ b/src/plugins/plugin.py @@ -25,6 +25,7 @@ Base class for implementing plugin. ''' import os +import locale from common import gajim @@ -197,7 +198,9 @@ class GajimPluginConfig(UserDict.DictMixin): @log_calls('GajimPluginConfig') def __init__(self, plugin): self.plugin = plugin - self.FILE_PATH = os.path.join(gajim.PLUGINS_CONFIG_DIR, self.plugin.short_name) + self.FILE_PATH = os.path.join(gajim.PLUGINS_CONFIG_DIR, + self.plugin.short_name).decode('utf-8').encode( + locale.getpreferredencoding()) #log.debug('FILE_PATH = %s'%(self.FILE_PATH)) self.data = None self.load()