[Python-Dev] Improve open() to support reading file starting with an unicode BOM (original) (raw)
Victor Stinner victor.stinner at haypocalc.com
Fri Jan 8 10:08:30 CET 2010
- Previous message: [Python-Dev] Improve open() to support reading file starting with an unicode BOM
- Next message: [Python-Dev] Improve open() to support reading file starting with an unicode BOM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Le vendredi 08 janvier 2010 03:23:08, MRAB a écrit :
Guido van Rossum wrote: > I'm a little hesitant about this. First of all, UTF-8 + BOM is crazy > talk. And for the other two, perhaps it would make more sense to have > a separate encoding-guessing function that takes a binary stream and > returns a text stream wrapping it with the proper encoding?
Alternatively, have a universal UTF-8/16/32 encoding, ie one that expects UTF-8, with or without BOM, or UTF-16/32 with BOM.
Do you mean open(filename, encoding="BOM")? I suppose that "BOM" would be a magical value specific to read a text file (open(filename, "r")), not a real codec?
Otherwise which encoding should be used for open(filename, "w", encoding="BOM")?
-- Victor Stinner http://www.haypocalc.com/
- Previous message: [Python-Dev] Improve open() to support reading file starting with an unicode BOM
- Next message: [Python-Dev] Improve open() to support reading file starting with an unicode BOM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]