-
Notifications
You must be signed in to change notification settings - Fork 1.6k
HttpUtils method urlEncodeFormParams Charset #1444
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
Comments
@keyhunter Could you provide a failing test case please? |
Of course, @slandelle .
` They all invoke the method urlEncodeFormParams0, the method use Utf8UrlEncoder, so produced the same result. But the real result is: |
@keyhunter Should be fixed (even though there's room for perf improvement). Could you please check on your side? |
Motivation: form urlencoding doesn’t properly honor charset. It uses it for converting the bytes while those are supposed to be already in the US-ASCII range. It should be using it the first encode into bytes, which should be then escaped. Modifications: Use current optimized code for UTF-8 and fall back to URLEncoder for other charsets. Results: Proper encoding when charset is different from UTF-8, eg GBK
OK, thanks. |
Uh oh!
There was an error while loading. Please reload this page.
When the charset is not utf-8 , this code (org.asynchttpclient.util.HttpUtils) will produce the wrong result
public static ByteBuffer urlEncodeFormParams(List<Param> params, Charset charset) { return StringUtils.charSequence2ByteBuffer(urlEncodeFormParams0(params), charset); }
This Code specifies the utf-8 encoding, and can't change, this will result in errors under other encodings(GBK etc).
The text was updated successfully, but these errors were encountered: