diff --git a/weixin/pay.py b/weixin/pay.py index bbffa0d..0e61253 100644 --- a/weixin/pay.py +++ b/weixin/pay.py @@ -75,7 +75,8 @@ def to_xml(self, raw): def to_dict(self, content): raw = {} - root = etree.fromstring(content.encode("utf-8"), + content = content.encode("utf-8") if isinstance(content,str) else content + root = etree.fromstring(content, parser=etree.XMLParser(resolve_entities=False)) for child in root: raw[child.tag] = child.text