A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-January/097118.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 BOM [Python-Dev] Improve open() to support reading file starting with an unicode BOMVictor Stinner victor.stinner at haypocalc.com
Fri Jan 8 11:31:37 CET 2010
Le vendredi 08 janvier 2010 01:52:20, Guido van Rossum a écrit :
> 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?

I choosed to modify open()+TextIOWrapper instead of writing a new function 
because I would like to avoid an extra read operation (syscall) on the file. 
With my implementation, no specific read operation is needed to detect the 
BOM. The BOM is simply checked in the first _read_chunk().

-- 
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