convert: Don't decode unicode strings
authorThomas Arendsen Hein <thomas@intevation.de>
Sat, 09 Feb 2008 13:13:46 +0100
changeset 6054 e2cbdd931341
parent 6053 4e87e785c5bf
child 6055 a3d8b1f8721d
convert: Don't decode unicode strings This does not work with python2.3 and is probably not useful anyway with 2.4.
hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py	Sat Feb 09 13:08:02 2008 +0100
+++ b/hgext/convert/convcmd.py	Sat Feb 09 13:13:46 2008 +0100
@@ -241,7 +241,10 @@
     def convert(self):
 
         def recode(s):
-            return s.decode('utf-8').encode(orig_encoding, 'replace')
+            if isinstance(s, unicode):
+                return s.encode(orig_encoding, 'replace')
+            else:
+                return s.decode('utf-8').encode(orig_encoding, 'replace')
 
         try:
             self.source.before()