Maurice Bauhahn <bauhahnm at clara.net> writes: > Could you, Martin, or anyone else on the list, give a short Jython script > which imports escaped unicode from a file (presumeably using codecs) and > exports utf-8 to a file? My attempts at the same have not been successful. Not sure what you mean by "importing" here. The file that you want to read - is it Python source code (which you would load using the import statement), or is a plain data file. If it is a plain data file, why do you insist on storing it in unicode-escaped encoding? I recommend to store it in UTF-8 >>> x=u"A test:\u1780, done." >>> import codecs >>> out=codecs.open("foo.txt","w","utf-8") >>> out.write(x) >>> out.close() >>> infile=codecs.open("foo.txt","r","utf-8") >>> infile.read() u'A test:\u1780, done.' >>> ^D So it works fine for me. OTOH, you seem to have lists that you want to store; I recommend using pickle for that. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4