[Tutor] Working with Umlauts

Magnus Lycka magnus@thinkware.se
Fri Jan 17 17:28:04 2003


At 22:22 2003-01-17 +0100, Tom Churm wrote:
>oops...sorry about that...i get it from COM from Lotus Notes (yech!).

Thought so...

>our sys admin for Lotus says that he's not sure if all user names in Lot=
us
>are in unicode, so i gotta make sure and convert them, especially since =
i'm
>then later accessing a different text file (not part of Lotus but placed=
 on
>our network) based on the user's name but with the umlauts replaced.

Most stuff you get from COM is Unicode, but it's no big deal
to turn unicode objects into string objects of the encoding of
your choice.

lastNameOfUser =3D lastNameOfUser.encode('latin1')

Now you have a string...and the rest will work.

>something, i gotta replace those umlauts, and there's gotta be a way..

I guess the really elegant way is to write a codec for
this, so that you can simply do

lastNameOfUser =3D lastNameOfUser.encode('ASCIIfiedUmlauts')

or something like that.


--=20
Magnus Lyck=E5, Thinkware AB
=C4lvans v=E4g 99, SE-907 50 UME=C5
tel: 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se