Question marks are usually only used when the char-byte mapper is all by itself aware of the encoding used in the both sides of the transfer. Any character in the source encoding which isn't supported by the target encoding will proactively be replaced by a question mark. In an average JSP/Servlet web application there are only 2 standard places where it can occur:
- Transferring characters between database and Java code through a JDBC connection.
- Transferring characters between webserver and webclient through HTTP response.
All other places would only end up in Mojibake (unintelligible sequence of characters, empty squares, replacement characters due to missing glyph in font, etc), not question marks.
In your case it's likely the second as there's no means of a database here. As you're using a JSP page, you should be setting the page encoding as below in top of the JSP page:
<%@page pageEncoding="UTF-8"%>
This basically sets the target encoding (and the charset
attribute in HTTP response Content-Type
header). Don't forget to also re-apply it on any include and tag file. If you'd like to configure it globally, so that you don't need to repeat the same boilerplate over all JSPs, then add the below entry to webapp's web.xml
:
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<page-encoding>UTF-8</page-encoding>
</jsp-property-group>
</jsp-config>
See also: