Description
URIBuilder always parses a given URI using UTF-8. For example given the following URI that still uses latin1:
%E4 is an enoded "ä" character in latin1.
new URIBuilder("http://host/?x=%E4").setCharset(ISO_8859_1).getQueryParams().get(0).getValue() outputs "�"
This is because the URIBuilder constructor already parses the given URI and the charset is at this time always null, thus UTF-8 is used.
Proposed fix:
Provide overloaded constructors that also allow to specify the charset; for example:
public URIBuilder(final String string, final Charset charset) throws URISyntaxException { this.charset = charset; digestURI(new URI(string)); }