Skip to content

How to decode POST requests with different charset #2196

Discussion options

You must be logged in to vote

To make a long story short: I don't expect Rocket to ever support this, since it's not standards conforming. https://url.spec.whatwg.org/#application/x-www-form-urlencoded has details on the content type, but the tl;dr is x-www-form-urlencoded doesn't actually have a charset argument, and is always utf-8. It does note that servers supporting legacy applications may have to support other charsets, but I don't expect this to be part of Rocket's form parser.

One solution is to write a custom form parser that accepts Shift-JIS, but this is time consuming and error prone. Alternatively, you could write a wrapper that first converts the form data to UTF-8, and then uses Rocket's form parser to …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@staticssleever668
Comment options

@staticssleever668
Comment options

@the10thWiz
Comment options

@staticssleever668
Comment options

@the10thWiz
Comment options

Answer selected by staticssleever668
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants