#2216: rencode changes str/unicode types
--------------------------+-------------------------------------------------
Reporter: gazpachoking | Owner:
Type: bug | Status: new
Priority: minor | Milestone: 1.3.x
Component: other | Version: 1.3.5
Keywords: |
--------------------------+-------------------------------------------------
Comment(by gazpachoking):
Simplest possible fix I can think of. Always output unicode objects from
rencode. (Unless a bytestring in some other encoding than utf8 was input.
Don't do that. Maybe we could even put in an assert for that to catch any
possible problems.)
{{{
#!diff
Index: deluge/rencode.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
===================================================================
--- deluge/rencode.py (date 1353044760000)
+++ deluge/rencode.py (revision )
@@ -160,9 +160,7 @@
colon += 1
s = x[colon:colon+n]
try:
- t = s.decode("utf8")
- if len(t) != len(s):
- s = t
+ s = s.decode("utf8")
except UnicodeDecodeError:
pass
return (s, colon+n)
}}}
--
Ticket URL: <http://dev.deluge-torrent.org/ticket/2216#comment:3>
Deluge <http://deluge-torrent.org/>
Deluge project
--
You received this message because you are subscribed to the Google Groups
"Deluge Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/deluge-dev?hl=en.