Re: Replace accented chars with unaccented ones
From: Jeff Epler (jepler_at_unpythonic.net)
Date: 03/16/04
- Next message: Cameron Laird: "Re: Tkinter3000"
- Previous message: Jeff Epler: "Re: Replace accented chars with unaccented ones"
- In reply to: Nicolas Bouillon: "Re: Replace accented chars with unaccented ones"
- Next in thread: Jeff Epler: "Re: Replace accented chars with unaccented ones"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 16 Mar 2004 08:00:36 -0600 To: python-list@python.org
On Tue, Mar 16, 2004 at 08:26:08AM +0100, Nicolas Bouillon wrote:
> Thank you both for your answer. They works well both very good.
>
> First, i believe i doesn't work, because the error i've made is to
> forgot the "u" for string : u"é". Because my file was already utf-8
> encoded (# -*- coding: UTF-8 -*-), i thinks the "u" is not necessary...
> i was wrong.
When there are non-unicode string literals in a file, they are simply
byte sequences. Take this program, for instance:
# -*- coding: utf-8 -*-
s = "é"
print len(s), repr(s)
$ python bytestr.py
2 '\xc3\xa9'
Jeff
- Next message: Cameron Laird: "Re: Tkinter3000"
- Previous message: Jeff Epler: "Re: Replace accented chars with unaccented ones"
- In reply to: Nicolas Bouillon: "Re: Replace accented chars with unaccented ones"
- Next in thread: Jeff Epler: "Re: Replace accented chars with unaccented ones"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|