Reputation: 18247
I'm trying to access a soap service with WSDL:
http://taqm.epa.gov.tw/taqm/DataService.asmx?WSDL
Using pysimplesoap
#!/usr/bin/python
from codecs import Codec
from pysimplesoap.client import SoapClient
url = 'http://taqm.epa.gov.tw/taqm/DataService.asmx?WSDL'
client = SoapClient(wsdl=url,trace=False)
response = client.SiteList2('xml')
result = response['SiteList2Result']
When I try to print the result, it says "UnicodeEncodeError: 'ascii' codec can't encode characters in position 49-50: ordinal not in range(128)".
I'm guessing the response has traditional Chinese big5 encoding (or perhaps utf-8) in there.
Response is a dict, when printing it directly it shows:
{'SiteList2Result': u'<NewDataSet><Table><SITE_CODE>1</SITE_CODE><SITE>\u57fa\u9686</SITE><HSCITY>\u57fa\u9686\u5e02</HSCITY><DISTRICT>\u4fe1 \u7fa9 \u5340</DISTRICT>...
Why is it using the ascii codec and what is it doing? How do I solve it?
Upvotes: 0
Views: 231