Browse Source

Do not mix raw and cooked lengths for trimming logic

Alois Mahdal 9 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
         suffix = u'…'
129
         suffix = u'…'
130
         cooked = raw.decode("utf-8")
130
         cooked = raw.decode("utf-8")
131
         if self.plugindata.fmt == "plain":
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
                 newlen = self.plugindata.maxlen - len(suffix)
133
                 newlen = self.plugindata.maxlen - len(suffix)
134
                 cooked = cooked[:newlen] + suffix
134
                 cooked = cooked[:newlen] + suffix
135
         return cooked.encode("utf-8")
135
         return cooked.encode("utf-8")