en UTF-8 tous les caractères sont codés sur 2 octets.
so what ?
Manifestement pas le "a" alors !!
Et pourquoi si on met un espace entre les caractères ca passe alors ?!
hg
Dan wrote:
On 22 nov, 19:05, "olive" wrote:
en UTF-8 tous les caractères sont codés sur 2 octets.
so what ?
Manifestement pas le "a" alors !!
Et pourquoi si on met un espace entre les caractères ca passe alors ?!
depuis la liste principale: ******************************************** hg wrote:
How would you handle the string.maketrans then ?
maketrans works on bytes, not characters. what makes you think that you can use maketrans if you haven't gotten the slightest idea what's in the string?
if you want to get rid of accents in a Unicode string, you can do the approaches described here
http://www.peterbe.com/plog/unicode-to-ascii
or here
http://effbot.org/zone/unicode-convert.htm
which both works on any Unicode string.
</F>
********************************************
Effectivement:
# -*- coding: utf-8 -*- import unicodedata title = u"àbcdeéô"
On 22 nov, 19:05, "olive" <ocolli...@gmail.com> wrote:
en UTF-8 tous les caractères sont codés sur 2 octets.
so what ?
Manifestement pas le "a" alors !!
Et pourquoi si on met un espace entre les caractères ca passe alors ?!
depuis la liste principale:
********************************************
hg wrote:
How would you handle the string.maketrans then ?
maketrans works on bytes, not characters. what makes you think that you
can use maketrans if you haven't gotten the slightest idea what's in the
string?
if you want to get rid of accents in a Unicode string, you can do the
approaches described here
http://www.peterbe.com/plog/unicode-to-ascii
or here
http://effbot.org/zone/unicode-convert.htm
which both works on any Unicode string.
</F>
********************************************
Effectivement:
# -*- coding: utf-8 -*-
import unicodedata
title = u"àbcdeéô"
en UTF-8 tous les caractères sont codés sur 2 octets.
so what ?
Manifestement pas le "a" alors !!
Et pourquoi si on met un espace entre les caractères ca passe alors ?!
depuis la liste principale: ******************************************** hg wrote:
How would you handle the string.maketrans then ?
maketrans works on bytes, not characters. what makes you think that you can use maketrans if you haven't gotten the slightest idea what's in the string?
if you want to get rid of accents in a Unicode string, you can do the approaches described here
http://www.peterbe.com/plog/unicode-to-ascii
or here
http://effbot.org/zone/unicode-convert.htm
which both works on any Unicode string.
</F>
********************************************
Effectivement:
# -*- coding: utf-8 -*- import unicodedata title = u"àbcdeéô"
Ok ! Et ca m'a permis de découvrir le forum en anglais. C'est sympa d'avoir posé la question pour moi.
My pleasure
olive
Cette méthode ne fonctionne pas pour tout les caractères (exemple : oe entrelacés).
PS: désolé pour la réponse précipitée à propos de UTF-8 (c'est bien sûr MC qui donne la bonne réponse à ce sujet).
Dan wrote:
On 22 nov, 19:05, "olive" wrote:
en UTF-8 tous les caractères sont codés sur 2 octets.
so what ?
Manifestement pas le "a" alors !!
Et pourquoi si on met un espace entre les caractères ca passe alors ?!
depuis la liste principale: ******************************************** hg wrote:
How would you handle the string.maketrans then ?
maketrans works on bytes, not characters. what makes you think that you can use maketrans if you haven't gotten the slightest idea what's in the string?
if you want to get rid of accents in a Unicode string, you can do the approaches described here
http://www.peterbe.com/plog/unicode-to-ascii
or here
http://effbot.org/zone/unicode-convert.htm
which both works on any Unicode string.
</F>
********************************************
Effectivement:
# -*- coding: utf-8 -*- import unicodedata title = u"àbcdeéô"
Cette méthode ne fonctionne pas pour tout les caractères (exemple :
oe entrelacés).
PS: désolé pour la réponse précipitée à propos de UTF-8 (c'est
bien sûr MC qui donne la bonne réponse à ce sujet).
Dan wrote:
On 22 nov, 19:05, "olive" <ocolli...@gmail.com> wrote:
en UTF-8 tous les caractères sont codés sur 2 octets.
so what ?
Manifestement pas le "a" alors !!
Et pourquoi si on met un espace entre les caractères ca passe alors ?!
depuis la liste principale:
********************************************
hg wrote:
How would you handle the string.maketrans then ?
maketrans works on bytes, not characters. what makes you think that you
can use maketrans if you haven't gotten the slightest idea what's in the
string?
if you want to get rid of accents in a Unicode string, you can do the
approaches described here
http://www.peterbe.com/plog/unicode-to-ascii
or here
http://effbot.org/zone/unicode-convert.htm
which both works on any Unicode string.
</F>
********************************************
Effectivement:
# -*- coding: utf-8 -*-
import unicodedata
title = u"àbcdeéô"
Cette méthode ne fonctionne pas pour tout les caractères (exemple : oe entrelacés).
PS: désolé pour la réponse précipitée à propos de UTF-8 (c'est bien sûr MC qui donne la bonne réponse à ce sujet).
Dan wrote:
On 22 nov, 19:05, "olive" wrote:
en UTF-8 tous les caractères sont codés sur 2 octets.
so what ?
Manifestement pas le "a" alors !!
Et pourquoi si on met un espace entre les caractères ca passe alors ?!
depuis la liste principale: ******************************************** hg wrote:
How would you handle the string.maketrans then ?
maketrans works on bytes, not characters. what makes you think that you can use maketrans if you haven't gotten the slightest idea what's in the string?
if you want to get rid of accents in a Unicode string, you can do the approaches described here
http://www.peterbe.com/plog/unicode-to-ascii
or here
http://effbot.org/zone/unicode-convert.htm
which both works on any Unicode string.
</F>
********************************************
Effectivement:
# -*- coding: utf-8 -*- import unicodedata title = u"àbcdeéô"
A priori la meilleure solution est là http://effbot.org/zone/unicode-convert.htm (code: http://effbot.python-hosting.com/file/stuff/sandbox/text/unaccent.py)
Cette méthode ne fonctionne pas pour tout les caractères (exemple : oe entrelacés).
A priori la meilleure solution est là
http://effbot.org/zone/unicode-convert.htm
(code:
http://effbot.python-hosting.com/file/stuff/sandbox/text/unaccent.py)
Cette méthode ne fonctionne pas pour tout les caractères (exemple :
oe entrelacés).
A priori la meilleure solution est là http://effbot.org/zone/unicode-convert.htm (code: http://effbot.python-hosting.com/file/stuff/sandbox/text/unaccent.py)
Cette méthode ne fonctionne pas pour tout les caractères (exemple : oe entrelacés).