Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL fragment parameters should be unicode #1

Closed
sma opened this issue Aug 16, 2009 · 1 comment
Closed

URL fragment parameters should be unicode #1

sma opened this issue Aug 16, 2009 · 1 comment
Labels
Feature This is a feature request, not a bug. Open for discussion.

Comments

@sma
Copy link

sma commented Aug 16, 2009

most if not all browsers will pass URLs utf-8 encoded (curl does). I shouldn't be required to decode that manually. Example:

@route(r"/:name")
def test(name):
    print `name`, type(name)
    return name

Now call this with curl http://localhost:8080/äöüß. A UnicodeDecodeError exception is raised. I can workaround this error by adding

@validate(name=lambda n:n.decode("utf-8"))

but I don't want to ;)

@defnull
Copy link
Member

defnull commented Aug 16, 2009

URLs are defined as byte strings and have no specific encoding. The client decides how to byte-encode unicode-URLs and there is no way for the Framework to guess the encoding used by the client. It is utf8 most of the time but URLs with raw bytes in them are allowed an encodings that would break a decode('utf8') do exist.

Same goes for GET parameter. Only POST-data can be properly decoded using the "Content-Transfer-Encoding" header.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature This is a feature request, not a bug. Open for discussion.
Projects
None yet
Development

No branches or pull requests

2 participants