[Tutor] UTF-8 title() string method
Jon Crump
jjcrump at myuw.net
Wed Jul 4 02:03:25 CEST 2007
Dear All,
I have some utf-8 unicode text with lines like this:
ANVERS-LE-HOMONT, Maine.
ANGOULÊME, Angoumois.
ANDELY (le Petit), Normandie.
which I'm using as-is in this line of code:
place.append(line.strip())
What I would prefer would be something like this:
place.append(line.title().strip())
which works for most lines, giving me, for example:
Anvers-Le-Homont, Maine.
and
Andely (Le Petit), Normandie.
but where there are diacritics involved, title() gives me:
AngoulÊMe, Angoumois.
Can anyone give the clueless a clue on how to manage such unicode strings
more effectively?
Many thanks,
Jon
More information about the Tutor
mailing list