A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-January/097114.html below:

[Python-Dev] Improve open() to support reading file starting with an unicode BOM

[Python-Dev] Improve open() to support reading file starting with an unicode BOMVictor Stinner victor.stinner at haypocalc.com
Fri Jan 8 10:08:30 CET 2010
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/

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4