[Tutor] local day names in ascii

frank h. frank.hoffsummer at gmail.com
Mon Jun 19 15:38:43 CEST 2006


Hello List,
i am trying to convert local Swedish daynames to ASCII

"Måndag" should become "Mandag"
"Lördag" should become "Lordag"
"Söndag" should become "Sondag"

here is my session

import locale
locale.setlocale(locale.LC_ALL, 'sv_Se')
datetime.date(2006, 06, 19).strftime("%A")
'M\xc3\xa5ndag'
datetime.date(2006, 06,
19).strftime("%A").decode('utf8').encode('ascii','ignore')
'Mndag'

Somehow, the Swedish character "å" gets dropped in the conversion to ascii.
how can I accomplish the conversion 'å' --> 'a' etc.? should I use a
dictionary?
thanks for any insight
-frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060619/6a38f2b2/attachment.html 


More information about the Tutor mailing list