Hi,
I am trying to send HTML string to server using RequestBuilder with JSON but without any success.
Everything works well when in HTML there are no double quotes or other JSON charachters.
So I am trying something like this
RichTextArea area = new RichTextArea();
String htmlToSend = area.getHTML();
JSONObject requestParams = new JSONObject();
requestParams.put("some_key", new JSONString(htmlToSend));
Unfortunately that string is not encoded properly to be safe to send with json
So if value retuned from area.getHTML() contains double quotes like this:
<p><a href="
http://www.denic.de/de/domains/recht/index.html" target="_blank">
www.denic.de/de/domains/recht/index.html</a></p>
request param looks like
{"some_key":"<p><a href="
http://www.denic.de/de/domains/recht/index.html" target="_blank">
www.denic.de/de/domains/recht/index.html</a></p>"}
JSONString method toString() on the other hand is calling JsonUtils.escapeValue(value) so that string should be escaped. And If I call escapeValue from JsonUtils by myself
i get string encoded but end up with two double quotes at the beginning and the end of that string..
Any help is welcome,
Thanks,
Milan