+1 vote
in AJAX by
How do I provide Internationalized Ajax Interactions?

1 Answer

0 votes
by

Step 1. Set the charset of the web page to an encoding this is supported through your goal languages. I generally tend to apply UTF-eight as it covers maximum languages. The following meta announcement in an HTML/JSP web page will set the content material kind:

Step 2. In the web page JavaScript ensures to encode any parameters despatched to the server. JavaScript gives the getaway() feature which returns Unicode get away strings wherein localized textual content will seem in hexadecimal format. For extra information on JavaScript encoding see evaluating get away(), encodeURI(), and encode URI Component().

Step 3. On the server-aspect aspect, set the man or woman encoding the use of the HttpServletRequest.setCharacterEncoding() approach. Before you get admission to the localized parameter the use of the HttpServletRequest.getParameter() name. In the case of UTF this will be request .set Character Encoding (“UTF-eight”);.

A server – aspect returning AJAX responses desires to set the encoding of the reaction to the identical encoding used at the web page.

reaction.setContentType("textual content/xml;charset=;UTF-eight");

reaction.getWriter().write(" invalid  ");

Related questions

0 votes
asked Aug 9, 2023 in AJAX by Robin
+2 votes
asked Nov 26, 2022 in AJAX by SakshiSharma
0 votes
0 votes
asked Jan 29 in AJAX by Robindeniel
0 votes
asked Aug 8, 2023 in AJAX by sharadyadav1986
...