VirtualMailManager/cli/subcommands.py
branchv0.7.x
changeset 657 6515e3b88dec
parent 656 4bbca60e0ba4
child 665 33d15936b53a
--- 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, '')