I would just like the python code to work but these conversion errors I don't understand (I always get some type of 'ascii' encoding or decoding error). I went crazy and did a decode and encode on every part of the line and it still giving me trouble. It's available via GIT at https://github.com/TBOpen/papercut if you would be so kind as to correct it (I also solved a similar error not checked in on line 885 using self.wfile.write(message.decode('cp1250', 'replace').encode('ascii', 'replace') + "\r\n").
However here's the traceback for the one I can't solve (where I gave up).
Traceback (most recent call last):
File "/usr/local/lib/python2.6/SocketServer.py", line 535, in process_request
self.finish_request(request, client_address)
File "/usr/local/lib/python2.6/SocketServer.py", line 320, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python2.6/SocketServer.py", line 615, in __init__
self.handle()
File "./papercut.py", line 221, in handle
getattr(self, "do_%s" % (command))()
File "./papercut.py", line 410, in do_ARTICLE
self.send_response("%s\r\n%s\r\n\r\n%s\r\n.".decode('cp1250', 'replace').encode('ascii', 'replace') % (response.decode('cp1250', 'replace').encode('ascii', 'replace'), result[0].decode('cp1250', 'replace').encode('ascii', 'replace'), result[1].decode('cp1250', 'replace').encode('ascii', 'replace')))
File "/usr/local/lib/python2.6/encodings/cp1250.py", line 15, in decode
return codecs.charmap_decode(input,errors,decoding_table)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2122' in position 20: ordinal not in range(128)
TIA!!
%-formatting—as Unicode, and then encode at output, instead of decoding and encoding all over the place?%splaceholders); it is already just ASCII.