From 00f28907e2f2ee67465c3e4bc87e6333da39ac0a Mon Sep 17 00:00:00 2001 From: gavinhughpalmer Date: Sun, 8 Jul 2018 18:54:40 +0100 Subject: [PATCH] Fix for encoding issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I was seeing an issue with the the currency symbol £ which was due to an encoding issue from the output from the response of the login call --- sfdclib/session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfdclib/session.py b/sfdclib/session.py index f84a5de..c724d0d 100644 --- a/sfdclib/session.py +++ b/sfdclib/session.py @@ -47,7 +47,7 @@ def login(self): password += self._token data = SfdcSession._LOGIN_TMPL.format(**{'username': self._username, 'password': password}) r = self.post(url, headers=headers, data=data) - root = ET.fromstring(r.text) + root = ET.fromstring(r.text.encode('utf8', 'ignore')) if root.find('soapenv:Body/soapenv:Fault', SfdcSession._XML_NAMESPACES): raise Exception("Could not log in. Code: %s Message: %s" % ( root.find('soapenv:Body/soapenv:Fault/faultcode', SfdcSession._XML_NAMESPACES).text,