0

For a query parameter of type array eg. 271,305, 315, the Java Uri.Builder encodes the commas that separate the individual values. How would you add something with a comma as a query parameter without encoding. I want to configure it so it doesn't change commas. It encodes url commas as %2c.

Uri.Builder builder = Uri.parse(baseUrl).buildUpon()
        .appendQueryParameter("searchText", paramSearchedText == null ? "" : paramSearchedText)
        .appendQueryParameter("cookieTags", selectedCookieTags);

selectedCookieTags has values such as 271,305, 315 but what i get is cookieTags=271%2C305%2C315.

Btw I searched couldn't find any duplicate post.

Amir Dora.
  • 2,777
  • 4
  • 31
  • 53

1 Answers1

1

Found URLDecoder which does the unicodes characters, modified return part of url

URLDecoder.decode(builder.build().toString(), "UTF-8");
Amir Dora.
  • 2,777
  • 4
  • 31
  • 53