Problem with \' in URLencoding

Posted by Bruce on Stack Overflow See other posts from Stack Overflow or by Bruce
Published on 2010-05-31T05:51:11Z Indexed on 2010/05/31 6:02 UTC
Read the original article Hit count: 287

Filed under:
|

I am working on Java. Here is my code

response = URLEncoder.encode(response, "UTF-8").replaceAll("\\+", "%20");

Problem comes when there is a ' (single quote) in the string response. It gets encoded to \'.

eg - 'Collective Dynamics of Complex Networks' comes as

\'Collective Dynamics of Complex Networks\'

I want it to remain as it is. What should I do?

© Stack Overflow or respective owner

Related posts about java

Related posts about url