Yet another problem with special characters (Ä, Ö, Ü, etc.)

Tim Roberts timr at probo.com
Thu Oct 10 02:09:12 EDT 2002


dominik.reiter at epost.de (Dominik Reiter) wrote:
>
>I'm trying to implement a CGI-script, which takes information from a
>HTML-Form and passes this information into a database. I get the
>information from the form just fine and the connection to the database
>also works. But when I do the INSERT-statement and one of the fields
>contains a German Umlaut (like 'Ö' for example), all I get in the
>database is \xd6 (for Ö). So if I want to insert 'Österreich' I get
>'\xd6sterreich'.

Right.  Ö is hex D6 in the Latin-1 encoding.

>If I try this with IDLE or the Shell in PythonWin, it's like this:
>
>>>> val = 'Ö'
>>>> print val
>Ö
>>>> val
>'\xd6'

Right.  'str' shows the character, 'repr' shows the hex value for
characters outside 0..127.

>I've implemented the sitecustomize.py and the changing of the default
>encoding works just fine, but the results to my problem are still the
>same. I've tried  several different encodings but none worked.
>
>Does anybody have an idea as to what I can do to make this work?

It looks to me like it is working perfectly.  Are you getting the wrong
answer when you actually go to USE this string?
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list