I have read this jsp page encoding problem and this Save Chinese characters with Spring-MVC / Java
I had the following code fragment in web.xml since the start of my project and it seems to injected correctly:
<!-- Reads request input using UTF-8 encoding -->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
And the http request has this header "content-type:application/x-www-form-urlencoded; charset=UTF-8" set but the log line shows this: Request Body Bean:[UserBean@4a8da092 fristname = '??', lastname = '??']
Also something wield is that I use NetBeans, if I mouse over to the variable firstname and lastname, they are shown correctly. Not sure what else do I need to get it working. Any help would be appreciated.
Sounds like everything is fine but your logger is not capable of showing those characters or perhaps the text viewer you are using to see those logs can not decode the characters.
You can rule out the text viewer by opening up the log file in a hex editor and looking for UTF-8 values that match up with your input (bytes that have a leading 1 or show up as negative values)