Reputation: 2348
My machine supports several language other than english e.g Chinese, Hindi & German.
I have a web application which sends escape(innerHTML)
from the client to server where innerHTML contents are written to a file at server side. It's working fine and there isn't any issue if the all charcters are in english.
But If any character is/are in non-english language i am getting exception at server side.
var innerHTML = escape (document.getElementBYId("id_1").innerHTML);
let suppose,
innerHTML = escape("<div id="test"> <p>
There are some text in english </p> </div>);
now i use AJAX to send this innerHTML to server and it works correctly.
above example is working if all chracter are in english but if the any chracter is in lets say Hindi, i am getting exception at server side
let suppose,
innerHTML = escape ( "<div id="test"> <p>
some text in **** hindi </p> </div>");
now, i send this via ajax function to the server but getteing error.
please give me any better idea to solve this issue. Should i apply internationalization
at client and server side as well ? or only at server side ?
*Exception i am getting at server side : *
Dec 21, 2011 4:55:15 PM org.apache.tomcat.util.http.Parameters processParameters
WARNING: Parameters: Character decoding failed. Parameter 'innerHTML' with value '
Upvotes: 0
Views: 402
Reputation: 117354
Try using encodeURIComponent() instead of escape()
Also be sure that the page is UTF8-encoded to be able to handle different languages.
Upvotes: 2