[sysadmin-bin: 104/168] Fix encoding handling for non-ascii literals
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin: 104/168] Fix encoding handling for non-ascii literals
- Date: Thu, 24 May 2012 20:00:11 +0000 (UTC)
commit 2966f3b7590ccff88bb9f8b90852230fba88754d
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Fri Apr 24 19:31:33 2009 -0400
Fix encoding handling for non-ascii literals
Decode unicode strings to UTF-8.
semi_rdf.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/semi_rdf.py b/semi_rdf.py
index 6079f85..8a27414 100755
--- a/semi_rdf.py
+++ b/semi_rdf.py
@@ -189,7 +189,10 @@ def _dump_node(f, node, lang, namespaces, depth=0):
f.write("/>\n")
elif isinstance(v, basestring):
f.write(">")
- f.write(escape(v))
+ if isinstance(v, str):
+ f.write(escape(v))
+ else:
+ f.write(escape(v).decode("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]