[Tutor] Working with Umlauts

Magnus Lycka magnus@thinkware.se
Fri Jan 17 17:06:01 2003


At 22:38 2003-01-17 +0100, Tom Churm wrote:
>i just tried this in IDLE and it worked:
>
> >>> import string
> >>> lastNameOfUser =3D "t=F6m"
> >>> lastNameOfUser =3D string.replace(lastNameOfUser,"=F6","oe")

Why not lastNameOfUser.replace("=F6","oe") ? You rarely need to
import string since Python 2.0. (Unless you need constants like
string.letter, string.digits etc)

> >>> print lastNameOfUser
>toem

Using ActivePython 2.2.1:

Python 2.2.1 (#34, Sep 27 2002, 18:37:42) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
 >>> import string
 >>> lastNameOfUser =3D "t=F6m"
UnicodeError: ASCII encoding error: ordinal not in range(128)
 >>>

But I've had a localization problems in IDLE before. At some
stage it used the locale setting for decimal separator, so with
Swedish settings that use decimal comma, it didn't understand
that

 >>> 1.5

was a floating point number, and of cource

 >>> 1,5
(1, 5)

:(

>so it looks like this is a problem with my PythonWin on ActivePython (he=
re
>at home i'm using the python.org python installation).

Or Python version?

>i'm going to call it quits with ActivePython and install the normal pyth=
on
>distribution at work, and then look for another editor.

I'm happy with PythonWin. Have been for years. I think I couldn't
survive without a folding editor not that I'm used to it.


--=20
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se