Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The documentation of Document.postDataCharset(String charset) says: "Sets the default post data character set for x-www-form-urlencoded post data."
At first I thought, it was not about the POST request but about the x-www-form-urlencoded data. Which means, that if I used this method sending a charset B as argument, even if I do a GET request the x-www-form-urlencoded data in it would've been converted into chartset B.
What is actually happening is that it's all about POST request and somehow it feels a bit weird. What is happening is that when it's a POST request Jsoup uses the charSet specified by postDataCharSet to transform the x-www-form-urlencoded data but for everything else it just uses a default charSet. The most funny thing is that the variable that postDataCharSet affects is initialized with this default charset.
I think that it would be better if Jsoup just used this value (specified using postDataCharSet) to transform x-www-form-urlencoded data, no matter the method used (as long as the method allows such kind of data).
I just changed two lines of code to make that happen.
I hope you reconsider this, it would make some people life easiser.