[Tutor] UTF-8 title() string method

Kent Johnson kent37 at tds.net
Wed Jul 4 22:33:55 CEST 2007


Terry Carroll wrote:
> I think setting the locale is the trick:
> 
>>>> s1 = open("text.txt").readline()
>>>> print s1
> ANGOUL.ME, Angoumois.
>>>> print s1.title()
> Angoul.Me, Angoumois.
>>>> import locale
>>>> locale.setlocale(locale.LC_ALL,('french'))
> 'French_France.1252'
>>>> print s1.title()
> Angoul.me, Angoumois.

I think your file is cp1252 not utf-8 as the OP specified...

Ken


More information about the Tutor mailing list