Read file that starts with '\xff\xfe'

Bob Gailer bgailer at
Mon Sep 8 16:13:06 CEST 2003

At 07:31 AM 9/8/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"
>  myFile =, "r", "utf16")
>If the file starts with a UTF-16 marker (either little or big endian) it
>will be read correctly. If it doesn't start with either marker reading from
>it will throw a UnicodeError.

Interesting error:

UniCodeError: UTF-16 decoding error: truncated data

Bob Gailer
bgailer at
303 442 2625
-------------- next part --------------

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003

More information about the Python-list mailing list