Fix running Gajim under windows for users with non-ascii char in account name. Fixes #5852

This commit is contained in:
Yann Leboulanger 2010-09-10 21:31:25 +02:00
parent 9f644dade0
commit 96de172951
2 changed files with 8 additions and 2 deletions

View File

@ -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:

View File

@ -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()