Browse Source

Do not mix raw and cooked lengths for trimming logic

Alois Mahdal 8 years ago
parent
commit
2401bdaa6a
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      include/sardine.py

+ 1
- 1
include/sardine.py View File

@@ -129,7 +129,7 @@ class Subcommand(object):
129 129
         suffix = u'…'
130 130
         cooked = raw.decode("utf-8")
131 131
         if self.plugindata.fmt == "plain":
132
-            if self.plugindata.maxlen and len(raw) > self.plugindata.maxlen:
132
+            if self.plugindata.maxlen and len(cooked) > self.plugindata.maxlen:
133 133
                 newlen = self.plugindata.maxlen - len(suffix)
134 134
                 cooked = cooked[:newlen] + suffix
135 135
         return cooked.encode("utf-8")