UriBuilder – skip specific characters from encoding

I try this:

URIBuilder uriBuilder = new URIBuilder("https://google.com");
uriBuilder.addParameter("a", "(aa,b b,cc)");

System.out.print(uriBuilder.build());
//...?a=%28aa%2Cb+b%2Ccc%29
//...?a=(aa%2Cb+b%2Ccc) <- this is what I want

I have a link with a parameter with value like (v1, v2, v3, ...).

v1, v2, v3, ... are generated based on some data. In some cases these values can contains space. Like in my example: b b. So it should be encoded. And all these values should be between () and separated by ,.

As you can see in my example () are encoded. Which is not good in my case.

How I can tell to URIBuilder to skip those 2 characters ( and )?



Read more here: https://stackoverflow.com/questions/64400457/uribuilder-skip-specific-characters-from-encoding

Content Attribution

This content was originally published by KunLun at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: