[sysadmin-bin: 105/168] Encode as UTF-8, not decode from UTF-8



commit 3d212d10ce77ab7824546013a331f4e5be7d6af8
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Fri Apr 24 19:32:32 2009 -0400

    Encode as UTF-8, not decode from UTF-8
    
    Last commit got direction of encoding wrong when handling
    non-ASCII.

 semi_rdf.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/semi_rdf.py b/semi_rdf.py
index 8a27414..74e5f79 100755
--- a/semi_rdf.py
+++ b/semi_rdf.py
@@ -192,7 +192,7 @@ def _dump_node(f, node, lang, namespaces, depth=0):
             if isinstance(v, str):
                 f.write(escape(v))
             else:
-                f.write(escape(v).decode("utf8"))
+                f.write(escape(v).encode("utf8"))
             f.write('</%s>\n' % qualname(n, namespaces))
         elif v == None:
             f.write("/>\n");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]