Python 2.6 StreamReader.readline()
Ulrich Eckhardt
ulrich.eckhardt at dominolaser.com
Wed Jul 25 02:09:49 EDT 2012
Am 24.07.2012 17:01, schrieb cpppwner at gmail.com:
> reader = codecs.getreader(encoding)
> lines = []
> with open(filename, 'rb') as f:
> lines = reader(f, 'strict').readlines(keepends=False)
>
> where encoding == 'utf-16-be'
> Everything works fine, except that lines[0] is equal to codecs.BOM_UTF16_BE
> Is this behaviour correct, that the BOM is still present?
Yes, assuming the first line only contains that BOM. Technically it's a
space character, and why should those be removed?
Uli
More information about the Python-list
mailing list