java

How to Set UTF-8 response on doPost() call?  #angularjs #reactjs

  • Debugging in my browser Developer tools Request Headers Request Headers
  • Set your charset to UTF-8 in Apache Sling Request Parameter Handling Default Parameter Encoding as shown below screenshot.
  • @i.net your are correct, i have missed out @Krish comment on Apache Sling Request Parameter Handling Default Parameter Encoding to _charset_=UTF-8 which is another way of forcing all the forms from AEM level to use UTF-8.
  • Stack Overflow works best with JavaScript enabled
  • In between code snippet is coming fine back to page.

I Am trying to have a JSON response back to the page with UTF-8 data, as it is what i have posted from the Form to my osgi servlet. The Servlet code is as shown below:

@ng_real_ninja: How to Set UTF-8 response on doPost() call? #angularjs #reactjs

I Am trying to have a JSON response back to the page with UTF-8 data, as it is what i have posted from the Form to my osgi servlet. The Servlet code is as shown below:

And my JSP Form code shown as below:

But when I submit the Form and see the output that has resulted back to the page is like with ANSI format. Where the the JSON data that I have added in the:

In between code snippet is coming fine back to page. But where as the form submitted same code is breaking when it received into servlet with:

How can I get the UTF enabled data that can be properly sent to Servlet and can do the JSON object with same.

Debugging in my browser Developer tools Request Headers

, and nothing else got changed. and the AEM is running in standalone local individual server not hosted via apache. – krish 2 hours ago

If you inspect the headers in your browsers dev tools, do you see correct encoding for respective req/response? – i.net 2 hours ago

@i.net updated my question with screenshots of developer tools. – krish 2 hours ago

where browser will fill-in the submitted character encoding as the field’s value.

java

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.