I am having to do stupid s**t like this to get urlEncoding to work like other libraries (iOS, Javascript..) because java.net.URLEncoder
is buggy or not written to standard encoding:
URLEncoder.encode(normalizeString(str), StandardCharsets.UTF_8.displayName())
.replace("+", "%20")
.replace("%40", "@")
.replace("*", "%2A");
+
and *
are not percent encoded while @
is. and...now it's encoding forward slash /
. wtf! is there a good explanation for this? Am I using the wrong Charset?