encode, only when result is unicode

This commit is contained in:
Dimitur Kirov 2006-02-27 18:07:38 +00:00
parent 89fabab718
commit 65ca70d29f
1 changed files with 8 additions and 2 deletions

View File

@ -253,7 +253,10 @@ class GajimRemote:
elif self.command == 'list_accounts':
if isinstance(res, list):
for account in res:
print account.encode(PREFERRED_ENCODING)
if isinstance(account, unicode):
print account.encode(PREFERRED_ENCODING)
else:
print account
elif self.command == 'account_info':
if res:
print self.print_info(0, res, True)
@ -265,7 +268,10 @@ class GajimRemote:
pref_keys.sort()
for pref_key in pref_keys:
result = '%s = %s' % (pref_key, res[pref_key])
print result.encode(PREFERRED_ENCODING)
if isinstance(result, unicode):
print result.encode(PREFERRED_ENCODING)
else:
print result
elif self.command == 'contact_info':
print self.print_info(0, res, True)
elif res: