[Tutor] Fwd: local day names in ascii

Andre Roberge andre.roberge at gmail.com
Mon Jun 19 16:55:49 CEST 2006


Message forwarded to the list for information.
André

---------- Forwarded message ----------
From: frank h. <frank.hoffsummer at gmail.com>
Date: Jun 19, 2006 11:06 AM
Subject: Re: [Tutor] local day names in ascii
To: Andre Roberge <andre.roberge at gmail.com>


André,
thank you so much for this spot-on pointer. the last comment indeed nails it.
excellent!!
-frank



On 6/19/06, Andre Roberge < andre.roberge at gmail.com> wrote:
> May I suggest you look at this
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/251871
> including the comments.  (The last comment in particular looks intriguing...)
>
> André
>
> On 6/19/06, frank h. < frank.hoffsummer at gmail.com> wrote:
> > 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
> >
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
> >
> >
>


More information about the Tutor mailing list