我只希望python代码正常工作,但是这些转换错误我不理解(我总是会遇到一些'ascii'编码或解码错误)。我疯了,对线路的每一部分都进行了解码和编码,但仍然给我带来麻烦。如果您愿意的话,可以通过GIT在https://github.com/TBOpen/papercut上找到它(我还使用self.wfile.write(message.decode('cp1250', 'replace').encode('ascii', 'replace') + "\r\n")解决了第885行中未签入的类似错误。在
不过,这是我无法解决的问题(我放弃了)的回溯。在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)
蒂娅!!在