# HG changeset patch # User Pascal Volk # Date 1354460064 0 # Node ID 6515e3b88dec7334bd95267eeb259992c817e472 # Parent 4bbca60e0ba4ca08c0d8c26c701fda7ca61d1cc7 VMM/cli/subcommands: Fixed some encode/decode issues. diff -r 4bbca60e0ba4 -r 6515e3b88dec VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Sat Dec 01 17:25:11 2012 +0000 +++ b/VirtualMailManager/cli/subcommands.py Sun Dec 02 14:54:24 2012 +0000 @@ -326,8 +326,7 @@ else: info[0]['bytes'] = human_size(info[0]['bytes']) info[0]['messages'] = locale.format('%d', info[0]['messages'], - True).decode(ENCODING, - 'replace') + True) info[0]['quota limit/user'] = q_limit % info[0] _print_info(ctx, info[0], _('Domain')) if details == 'accounts': @@ -997,7 +996,8 @@ if not domain.startswith('xn--'): w_std('\t%s' % domain) else: - w_std('\t%s (%s)' % (domain, domain.decode('idna'))) + w_std('\t%s (%s)' % (domain, + domain.encode('utf-8').decode('idna'))) print() else: w_std(_('\tNone'), '') @@ -1032,7 +1032,7 @@ def _format_domain(domain, main=True): """format (prefix/convert) the domain name.""" if domain.startswith('xn--'): - domain = '%s (%s)' % (domain, domain.decode('idna')) + domain = '%s (%s)' % (domain, domain.encode('utf-8').decode('idna')) if main: return '\t[+] %s' % domain return '\t[-] %s' % domain @@ -1102,7 +1102,8 @@ title = _('Alias domain information') for key in ('alias', 'domain'): if info[key].startswith('xn--'): - info[key] = '%s (%s)' % (info[key], info[key].decode('idna')) + info[key] = '%s (%s)' % (info[key], + info[key].encode(ENCODING).decode('idna')) w_std(title, '-' * len(title), _('\tThe alias domain %(alias)s belongs to:\n\t * %(domain)s') % info, '')