Reputation: 1096
im trying to get german umlaute in my url variables. This is my code:
class Root:
def echo(self,input):
return input
echo.exposed = True
if __name__ == '__main__':
cherrypy.quickstart(Root(),'/')
This works fine:
http://localhost:8080/echo/?input=äöüß
Result: äöüß
But when i try:
http://localhost:8080/echo/äöüß
I get: äöüÃ
Does anyone know the reason and how i can fix this?
Upvotes: 2
Views: 773
Reputation: 4578
Try this:
import cherrypy
class Root:
def echo(self,input):
return bytes(input, 'Latin-1')
echo.exposed = True
if __name__ == '__main__':
cherrypy.quickstart(Root(),'/')
or do this:
class Root:
@tools.encode(encoding='Latin-1')
def echo(self,input):
Cherrypy is by default encoded utf-8. Hope this helps!
Upvotes: 2