Hello there,

I wrote a code for reading xml datas from one url, the code is working fine, but if data contains "-" it throw error message.

Here is my code

h = httplib2.Http('.cache')
		    response, content = h.request(dataurl)
                                    data = content.decode('utf-8')
		    elem = etree.fromstring(data)

i am getting error on last line, if data contains "-"

My error as follows
UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 237: ordinal not in range(128)


Any ideas how to resolve this?

I wonder why there is nothing like SimpleXML in PHP.
in PHP XML is extremely simple!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.