I have come a cross a problem with hebrew letters and UTF-8 which I need some help to clarify.
Our webapp is using spring mvc 2.5.6 and is currently supporting utf-8 charecters in input fields – such as danish letters æøå and some hebrew letters like ר and ס. However, not all hebrew characters are supported. E.g if i use the search string like רעננה it is “translated” to רעננ�? when submitted. Clearly, the ה is not supported!
The characterset encoding is set using spring characterencoding filter like:
<filter>
<filter-name>charsetFilter</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>
</filter>
And as it is obviuos, it is working for some characters. What is needed to make it support all hebrew charaters?
I finally found the solution. Instead of using java’s new String(bytes, encoding), I use javascript’s encodeURIComponent(string) of the searchString before setting the request parameter. In java the term is decoded using URLDecode.decode(String, Encoding), which works beautifully.