Hello all,
I want to send a json object from a
servlet to a javascript page. The json object contains a field named "text" that must be encoded or it will not be handled properly by the javascript code (Jquery library - $.ajax method with dataType: 'json' enabled).
So I encoded the
string inside the servlet with: URLEncode("string body ". "UTF-8") and try to decode it's content in Javascript using: unescape("string body").
It all went fine except for the fact that the sign + was not replaced by space after decoding.
Is there any function in
Java that can encode a string so that Javascript's "unescape" function can properly decode it?
I don't wat to use replace.
Thanks in advance