Search code examples
javaserver-sideurlencodehtml-entitiesurldecode

On server side URL parameter value after encode/decode looks 'strange'. Why?


On client side (in Browser) URL looks like this one:

http://www.google.com?param1=Name1%3DValue1

it means, that parameter param1 has value Name1=Value1

On Server Side, I see, that param1 has value Name1=Value1

I found info, that '=' is HTML Entity (decimal) for character "=".

Main problem, that I do not have full access to code on server side.

Could you please provide some recommendation how I can convert HTML Entity to "=". And What do you think, it is valid situation that on server side URL parameter has HTML Entity or it is bug?


Solution

  • That is weird. I'm lost as to why URL encoded characters would be converted to encoded HTML entities. Anyway, if all you are interested in is converting it to Name=Value, take a look at this code.

    System.out.println(StringEscapeUtils.unescapeHtml("Name1=Value1"));
    

    Output

    Name1=Value1

    Where StringEscapeUtils is from the apache commons lang project.