Browse Source

Encode/decode UTF-* properly

Alois Mahdal 8 years ago
parent
commit
96b9342e43
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      include/sardine.py

+ 4
- 4
include/sardine.py View File

@@ -126,13 +126,13 @@ class Subcommand(object):
126 126
         self.plugin = module.Plugin(self.plugindata)
127 127
 
128 128
     def _format_output(self, raw):
129
-        suffix = "…"
130
-        cooked = raw
129
+        suffix = u'…'
130
+        cooked = raw.decode("utf-8")
131 131
         if self.plugindata.fmt == "plain":
132 132
             if self.plugindata.maxlen and len(raw) > self.plugindata.maxlen:
133 133
                 newlen = self.plugindata.maxlen - len(suffix)
134
-                cooked = raw[:newlen] + suffix
135
-        return cooked
134
+                cooked = cooked[:newlen] + suffix
135
+        return cooked.encode("utf-8")
136 136
 
137 137
     def get_output(self):
138 138
         return self._format_output(self.plugin.render())