From 85ed5fa5dae0fe236584926824f7292b6e697e76 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Thu, 19 Sep 2013 03:15:26 +0200 Subject: [PATCH] Do Unicode conversion from bytestring more properly. --- wrw/sp/cons.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wrw/sp/cons.py b/wrw/sp/cons.py index 4052dce..ff0d0af 100644 --- a/wrw/sp/cons.py +++ b/wrw/sp/cons.py @@ -1,3 +1,4 @@ +import sys import xml.dom.minidom class node(object): @@ -39,9 +40,11 @@ class element(node): return self.__todom__(doc).toxml() class context(object): + charset = sys.getfilesystemencoding() + def __init__(self): self.nodeconv = {} - self.nodeconv[str] = lambda ob: text(ob, "utf-8") + self.nodeconv[str] = lambda ob: text(ob, self.charset) self.nodeconv[unicode] = text self.nodeconv[int] = text self.nodeconv[long] = text -- 2.11.0