A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/299003.html below:

RE + UTF-8

RE + UTF-8 RE + UTF-8Michael Ströder michael at stroeder.com
Sun Sep 25 01:44:08 EDT 2005
cepl at surfbest.net wrote:
> 
> I have tried to test RE and UTF-8 in Python generally and the results
> are even more confusing (done with locale cs_CZ.UTF-8 in konsole):
> 
>>>locale.getpreferredencoding()
> 
> 'UTF-8'
> 
>>>>print re.sub("(\w*)","X","[Chelcický]",re.L)

You first have to turn the raw strings into Unicode strings. It seems on
your console it should be:

unicode('[Chelcický]','utf-8')

Note that you have to set HTTP headers and <form accept-charset=...> in
web applications.

Ciao, Michael.

More information about the Python-list 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