changeset 6054:e2cbdd931341

convert: Don't decode unicode strings This does not work with python2.3 and is probably not useful anyway with 2.4.
author Thomas Arendsen Hein <thomas@intevation.de>
date Sat, 09 Feb 2008 13:13:46 +0100
parents 4e87e785c5bf
children a3d8b1f8721d
files hgext/convert/convcmd.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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()