--- core.py.orig	2008-02-22 07:52:30.000000000 +0100
+++ core.py.better	2008-02-22 08:05:09.000000000 +0100
@@ -402,7 +402,11 @@
             return cls()
         if type(text) is cls:
             return text
-        text = unicode(text).replace('&', '&amp;') \
+        if isinstance(text,str):
+            text=text.decode('utf-8')
+        else:
+            text = unicode(text)
+        text=text.replace('&', '&amp;') \
                             .replace('<', '&lt;') \
                             .replace('>', '&gt;')
         if quotes:
