From 287138686c8471d7bd1d36e913dfebabd57518b1 Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 15 Apr 2020 00:52:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=96=E7=A0=81=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weixin/pay.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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