]> git.decadent.org.uk Git - dak.git/commitdiff
textutils.py: don't try to convert unicode strings again
authorAnsgar Burchardt <ansgar@debian.org>
Sun, 17 Jun 2012 07:33:25 +0000 (09:33 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Sun, 1 Jul 2012 11:07:42 +0000 (13:07 +0200)
daklib/textutils.py

index 03df5d8590657c9273b5eb1e7fac05db2a0ce19c..c9cc4ed380e7a6885b109b154b45893d5c046acc 100644 (file)
@@ -34,6 +34,8 @@ def force_to_utf8(s):
     Forces a string to UTF-8.  If the string isn't already UTF-8,
     it's assumed to be ISO-8859-1.
     """
+    if isinstance(s, unicode):
+        return s
     try:
         unicode(s, 'utf-8')
         return s