Saturday, August 24, 2013

Stripes jsp / jstl forms won't handle unicode / utf-8 characters. Yikes. What's wrong?

I don't know what's wrong in your case. But in my case stripes+tomcat+mysql case I had my database set up OK (from my.cnf)
[mysqld]#default-character-set=utf8#default-collation=utf8_general_cicharacter-set-server=utf8collation-server=utf8_general_ciinit-connect='SET NAMES utf8'character-set-filesystem = UTF8
and all my forms looked great:

<s:form beanclass="${actionBean.getClass().name}" acceptcharset="utf-8">
but unicode values would not return forms in utf-8 format.

I tried all the solutions found at TechnologyNotes: UTF-8 Encoding fix (Tomcat, JSP, etc), but those didn't work. So I undid most of them.

What did work for me was found within this Stripes HowTo.  I changed this:
<init-param>  <param-name>LocalePicker.Locales</param-name>
  <param-value>en:UTF-8, en_US:UTF-8</param-value>
to this:
  <param-value>en:UTF-8, en_US:UTF-8</param-value>
And unicode characters in forms worked swell. Whoopee.