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/2008-April/078794.html below:

[Python-Dev] Encoding detection in the standard library?

[Python-Dev] Encoding detection in the standard library?Oleg Broytmann phd at phd.pp.ru
Tue Apr 22 00:17:01 CEST 2008
On Mon, Apr 21, 2008 at 06:37:20PM -0300, Rodrigo Bernardo Pimentel wrote:
> On Mon, Apr 21 2008 at 06:31:06PM BRT, "\"Martin v. L??wis\"" <martin at v.loewis.de> wrote:
> > > This is useful when you get a hunk of data which _should_ be some  
> > > sort of intelligible text from the Big Scary Internet (say, a posted  
> > > web form or email message), and you want to do something useful with  
> > > it (say, search the content).
> > 
> > I don't think that should be part of the standard library. People
> > will mistake what it tells them for certain.
> 
> Maybe call it "charguess", then?

   The famous chardet returns probablity of its guessing:

>>> import chardet
>>> chardet.detect("dabc")
{'confidence': 1.0, 'encoding': 'ascii'}
>>> chardet.detect("ั‚ะตัั‚")
{'confidence': 0.98999999999999999, 'encoding': 'KOI8-R'}

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.
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