Python 2.6 StreamReader.readline()

cpppwner at cpppwner at
Tue Jul 24 17:01:28 CEST 2012


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.


More information about the Python-list mailing list