Python 2.6 StreamReader.readline()

cpppwner at gmail.com cpppwner at gmail.com
Tue Jul 24 11:01:28 EDT 2012


Hi,

I have a simple question, I'm using something like the following lines in python 2.6.2

    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?

Thanks in advance for your help.

Best,
Stefan



More information about the Python-list mailing list