Why does my Servlet request lose UTF-8 encoding in passed-in attributes?

Rahul kumar Gupta

[I use setAttributes() in the HttpServletRequest object to pass UTF-8 strings to a servlet. On the receiving servlet, I receive only '?' for each unicode character. What should I do?]

There is no need to set the attribute ,you have to just the set the Content type in each and every page(JSP/ Servlets) and rest is atuomatically being taken care of.

You can set the content type like this

String contentType= "text/html;charset=UTF-8";