Open
Description
Hi,
I'm using your library in some projects here, it's great.
It would be great to have a setter method to set the encoding when parsing a response as a document.
For example, if I need to execute a post request and parse the response as a Document
with the ISO-8859-1
encoding, I have to do this:
private Document executeRequest(String value2) throws IOException {
return Jsoup.connect(DEFAULT_URL)
.timeout(DEFAULT_TIMEOUT)
.data("param1", "value1")
.data("param2", value2)
.userAgent(DEFAULT_USER_AGENT)
.method(Method.POST)
.execute()
.charset(CHARSET_ISO_8859_1)
.parse();
}
It would be great something like this:
private Document executeRequest(String value2) throws IOException {
return Jsoup.connect(DEFAULT_URL)
.timeout(DEFAULT_TIMEOUT)
.data("param1", "value1")
.data("param2", value2)
.userAgent(DEFAULT_USER_AGENT)
.responseEncoding("ISO-8859-1") // <-- This is the setter method I'm suggesting, something like that
.post();
}
The postDataCharset
method sets the charset when sending a POST request, but not for parsing the response as a document.
Of course the method name is your choice.
What do you think?
P.S: @krystiangorecki This is the issue with the correct description.
Metadata
Metadata
Assignees
Labels
No labels