[Pythonmac-SIG] Accented characters

Jack Jansen Jack.Jansen at cwi.nl
Tue Jul 13 22:07:41 CEST 2004


I knew there was a solution to this, but it wasn't easy to find:-)

But I did find it: see <http://www.python.org/peps/pep-0263.html> for 
an explanation on how to state the encoding of your sourcefile. And the 
easiest way to do it is to save your file as UTF-8 and with BOM marks. 
I think BBEdit has an option to save files in this format.

On 10 Jul 2004, at 23:22, Quarante-Deux wrote:

> I'm new to python and I need to process some text written in French 
> with various accented characters.
>
> I have read about the locale module and codecs and anything else I 
> could find to no avail.
>
> In IDLE I can't even type an accented character.
>
> In Terminal, I must activite "escape non ASCII characters" in the 
> Emulation setting.
>
> If I write a script that writes a file to disk I never get anything 
> good either.
>
> I have tried various combinations of locale.setlocale, and also 
> various combinations of unicode and locale settings for the re module. 
> Nothing works.
>
> I need:
> 1/ to be able to sort correctly
> 2/ to be able to have regular expressions recognize word boundaries 
> correctly.
>
> I'm using Mac OSX with the preinstalled Python 2.3.3. I either use 
> IDLE or BBEdit and the Terminal.
>
> Thanks for any help.
>
> Ellen
> -- 
> -------------------------------------------------------------------
> xlii at xlii.org                          |  Ellen C. Herzfeld
> http://www.quarante-deux.org/          |  Dominique O. Martel
> Quelques pages sur la Science-Fiction  |  Quarante-Deux
> -------------------------------------------------------------------
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman



More information about the Pythonmac-SIG mailing list