Pylons / Pylons/webtest

Form POST with unicode values is not encoded properly

Open
#150 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
346
Forks
113
PR merge metrics
No merged PRs in 30d

Description

When you do a post() with unicode data in it, it won't be encoded properly unless you specify a content_type with charset=utf8.

However, the mime type application/x-www-form-urlencoded doesn't officially support a charset property. If the server accepts multiple charsets it has to get that information elsewhere.

I think it might be reasonable to encode any unicode keys or values in a form to UTF-8 by default if there is no content_type or no charset on the content_type.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the post() request path and locate the form encoding logic and its existing tests. Reproduce a POST with Unicode keys or values without a charset, then verify that the form data is encoded as UTF-8 by default while explicit charset handling remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.