Jython: How to import escaped Unicode and export utf-16?
Martin von Loewis
loewis at informatik.hu-berlin.de
Tue May 1 16:11:32 EDT 2001
Maurice Bauhahn <bauhahnm at clara.net> writes:
> (UNIESCAPE_encode, UNIESCAPE_decode, UNIESCAPE_streamreader,
> UNIESCAPE_streamwriter)=codecs.lookup('raw-unicode-escape')
>
> onea =
> UNIESCAPE_streamreader(codecs.open('H:\\jy\\encodings\\KSCIIOne.txt','r','raw-unicode-escape'))
>
> oneencoding = onea.read()
Not sure why you are wrapping a streamreader around the result of
codecs.open. That should not be necessary, if you want to read a
unicode-escaped file into a Unicode string (I'd prefer not to call the
operation of reading a file "import").
Regards,
Martin
More information about the Python-list
mailing list