Forums

Edit Library

I am using xmltodict in my project to read som Norwegian sites. The problem is that there are spesial characters that i have to encode to utf-8 and xmltodict wants to encode it to ascii. I get the error:


File "/usr/lib/python3.5/http/client.py", line 983, in putrequest self._output(request.encode('ascii')) UnicodeEncodeError: 'ascii' codec can't encode character '\xd8' in position 16: ordinal not in range(128)


On my local machine i just edit the lib to: self._output(request.encode('utf-8')) and it works fine. What can i do here?

You could install it using --user (which puts the library in ~/.local) or you could install it into a virtualenv and edit the code in the virtualenv. Though that does seem like either you're misinterpreting how to use the library and there's another way, or like it's a bug in the library that you should report.