Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gmethvin
Copy link
Member

Fixes #5919.

Requires backport to 2.5.x.

@gmethvin gmethvin force-pushed the charset branch 7 times, most recently from 2f56a08 to 644e2b0 Compare March 20, 2016 11:03
@nik-kashi
Copy link
Contributor

I wrote a custom BodyParser based these changes and that works properly.
Thanks @gmethvin

@marcospereira
Copy link
Member

Isn't ISO-8859-1 the default charset, as defined at RFC 2616? On a second look, RFC 7230 apparently removed this default.

Edit: but looks like there are other parsers (TolerantText, per instance) using ISO-8859-1 as theirs default. Also, when parsing response bodies, play-ws is using the AHC default charset, which looks like is ISO-8859-1.

@gmethvin
Copy link
Member Author

@marcospereira RFC 2616 defines defaults for text/* content types but doesn't mention anything about application/x-www-form-urlencoded. TolerantText is designed to be used with text content types, so that default makes sense there.

You can find a decoding algorithm for application/x-www-form-urlencoded here. We don't actually follow this algorithm completely (we don't read the special _charset_ field for example), so we might want to fix that in the future.

@marcospereira
Copy link
Member

Thanks for the explanation, @gmethvin. Also, I think we can add a test case to check cases where the default charset is used and also when the request charset is specified. framework/src/play-integration-test/src/test/scala/play/it/http/parsing/FormBodyParserSpec.scala looks like the right place for Scala specs. Not sure if there is a specific test for the Java version.

@gmethvin gmethvin force-pushed the charset branch 2 times, most recently from adaf9e2 to fbba6e7 Compare March 23, 2016 05:39
@gmethvin
Copy link
Member Author

@marcospereira tests added

@marcospereira marcospereira merged commit ebd538d into playframework:master Mar 23, 2016
@mkurz
Copy link
Member

mkurz commented Mar 23, 2016

@marcospereira Can you backport to 2.5.x?

@marcospereira
Copy link
Member

@mkurz already doing it. ;-)

@mkurz
Copy link
Member

mkurz commented Mar 23, 2016

👍

@marcospereira
Copy link
Member

Backport to 2.5.x: 6d63a8b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants