charset problems with urllib/urllib2


B

Brot

Hello,

I am using the mailman-installation (http://www.gnu.org/software/
mailman/) from my hosting company. I doesn't have access to the
add_members script and so I am writing a python script which uses http
requests to subscribe new members.

But if I am posting a new member with an name, which includes "German
Umlaute" I see only weird characters in the admin-interface.
The mailman webinterface doesn't use utf-8. It always uses the
corresponding charset for the actual language setting.
If I post "Bärbel Rüssel" the admin-interface shows me the following
name: "Bärbel Rüssel"
I am using the German language setting, so mailman uses the ISO-8559-1
charset in the webinterface. If I switch my browser to UTF-8 the name
is correct in the admin-interface, but all other special characters
are wrong.

The strange thing for me is, that the name is correct if I subscribe
the member in the admin-interface manually. I don't know what the
different is between my python script and the manuell subscription.

To Post to my mailman-server I use this recipe (http://
code.activestate.com/recipes/146306/) to generate the
multipart/form-data POST

I looked into the Mailman source code and found the Util.canonstr
method. At the end it changes the string to an unicode string. So the
name is stored as unicode, isn't it? But why is there a difference if
I display the manuell inserted name and the automatic inserted name??

I used Tamper Data (https://addons.mozilla.org/en-US/firefox/addon/
966) to catch the request when I inserted the data manually through
the webinterface. The request generated with my script looks the same,
but the output isn't?

Does anyone have experience with this problem or with mailman and
urllib/urllib2?

~ Bernd
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top