universal newlines and utf-16

B

Baz Walter

i am using python 2.6 on a linux box and i have some utf-16 encoded
files with crlf line-endings which i would like to open with universal
newlines.

so far, i have been unable to get this to work correctly.

for example:
"u'a\\n\\nb\\n\\n'"

of course, the output i want is:

"u'a\\nb\\n'"

i suppose it's not too surprising that the built-in open converts the
line endings before decoding, but it surprised me that codecs.open does
this as well.

is there a way to get universal newlines to work properly with utf-16 files?

(nb: i'm not interested in other methods of converting line endings -
just whether universal newlines can be made to work correctly).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top