Read file that starts with '\xff\xfe'

Peter Hansen peter at
Mon Sep 8 17:21:25 CEST 2003

Duncan Booth wrote:
> Bob Gailer <bgailer at> wrote in
> news:mailman.1063025195.15280.python-list at
> > That's a good start. I presume I need to use,
> > mode[, encoding[, errors[, buffering]]]) to read the file. What is the
> > actual value of the "encoding[" parameter for "Little-endian UTF-16
> > Unicode character data, with CR line terminators"
> Try:
>  myFile =, "r", "utf16")

I don't do unicode, but might you not want "rb" instead of just "r"
in the above?  Does that argument apply to the low-level "open" or
to the codec open?  In other words, when would CR-LF translation be
happening if you specified just "r"?


More information about the Python-list mailing list