Windows vs. file.read

Thomas Jollans thomas at jollybox.de
Thu Sep 2 21:30:56 CEST 2010


On Thursday 02 September 2010, it occurred to ipatrol6010 at yahoo.com to 
exclaim:
> Correct in that regard. In Python 3.x, strings are by default considered
> UTF-8. Wheras ASCII isn't a problem because it's fixed-width, UTF-8 will
> give you a different character depending on the last byte value. Therefore
> handling any kind of data that is not UTF-8 will need you to open it with
> 'b' and uses bytes instead of str (literals with b'some value').

Except if it's text of a known encoding, in which case you just open it with 
that encoding.



More information about the Python-list mailing list