[Python-Dev] Quick sum up about open() + BOM (original) (raw)

Glenn Linderman v+python at g.nevcal.com
Sat Jan 9 01:47:38 CET 2010


On approximately 1/8/2010 3:59 PM, came the following characters from the keyboard of Victor Stinner:

Hi,

Thanks for all the answers! I will try to sum up all ideas here.

One concern I have with this implementation encoding="BOM" is that if there is no BOM it assumes UTF-8. That is probably a good assumption in some circumstances, but not in others.

So the point is, that it might be nice to have "BOM-otherEncodingForDefault" for each other encoding that Python supports. Not sure that is the right API, but I think it is expressive enough to handle the cases above. Whether the cases solve actual problems or not, I couldn't say, but they seem like reasonable cases.

It would, of course, be nicest if OS metadata had been invented way back when, for all OSes, such that all text files were flagged with their encoding... then languages could just read the encoding and do the right thing! But we live in the real world, instead.

-- Glenn -- http://nevcal.com/

A protocol is complete when there is nothing left to remove. -- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking



More information about the Python-Dev mailing list