Need help with umlaut in URL
#1
Hi,

i try to update my kino.de script at the moment. Now i ran into some problem:

if i want to get cinemadata from citys with no umlaut or special character everythings works well, but if i try to fetch pages from citys with umlaut, i get the wrong page, because the umlauts or special characters are wrong encoded (i think)

so here is the code snipped:

PHP Code:
def getPage(selfcitypages):
        
# city comes from a list of unicode strings!
        
url 'http://kino.de/kinosuche.php4?searchortplz='
        
url url urllib.quote(city,'/=&:?')
        
self.filmContentText.setText(url)
        
debugwrite(str(url))
        
pagetext urllib.urlopen(str(url)).read()
        
pagetext pagetext.decode('iso-8859-1')
        
self.filmContentText.setText(pagetext)
        
self.HTMLPage pagetext 
if i enter the url in my browser i get the right side:
for example:
München:
http://kino.de/kinosuche.php4?searchortplz=M%FCnchen

but with the urlopen i get the side from
http://kino.de/kinosuche.php4?searchortplz=M%25FCnchen

so in the form on the page is "M%FCnchen" written instead of the wanted "München"


please help!

Tia

Morte
Reply
#2
Don't quote the city.

Quote:url = url + city

Reply
#3
Now i got it working.

Nuka was right with the quoting, but i had to encode the string as latin-1 at the end. so here is the working code (maybe someone runs into the same problem as i did)

PHP Code:
def getPage(selfcitypages):
        
url 'http://kino.de/kinosuche.php4?searchortplz='
        
url url city
        url 
url.encode('latin-1')
        
pagetext urllib.urlopen(str(url)).read()
        
pagetext pagetext.decode('iso-8859-1')
        
self.filmContentText.setText(pagetext)
        
self.HTMLPage pagetext 

THX NUKA
Reply

Logout Mark Read Team Forum Stats Members Help
Need help with umlaut in URL0