Reputation: 2411
I'm using java.net.URLDecoder
to decode a URL parameter that is supposed to be encoded in UTF-8. A quick test reveals I'm getting ?
instead of ∩
in the output. Here's the code:
System.out.println(java.net.URLDecoder.decode("A%E2%88%A9B%0AYour+answer+is%3A+3", "UTF-8"));
And as output I'm getting:
A?B
Your answer is: 3
When I plug the string A%E2%88%A9B%0AYour+answer+is%3A+3
into web decoders (e.g. here or here), they get it right:
A∩B
Your answer is: 3
Does anyone know what I'm doing wrong. Is this not actually UTF-8? The string is coming from com.google.gwt.http.client.URL.encodeQueryString(), which claims UTF-8 encoding.
Upvotes: 1
Views: 108