I have a column in the PostgreSQL database which contains Arabic data. When reading the data from the database in the controller it's been read fine, the encoding is good, but when sending the data to the JSP page and trying to read it, they appears as something like ?????????
. Any ideas why something like this occur?
views:
129answers:
2
A:
make sure the jsp page supports UTF8 we have been through similar cases with Oracle 10g speaking to SQL Server, and it was resolved by changing the table to be capable of storing UTF8 data
A.Rashad
2010-05-19 09:27:31
+1
A:
You need to set the HTTP response encoding. If you're using JSP as view technology, then you need to add the following line to top of the JSP's:
<% @page pageEncoding="UTF-8" %>
This will force the servletcontainer to write characters to the response in the specified encoding and this will implicitly also add the correct charset
to the HTTP Content-Type
response header so that the webbrowser knows what encoding to use to display those characters.
Also see this article for more insights: Unicode - How to get the characters right? Solutions for JSP/Servlet response are described here.
BalusC
2010-05-19 12:01:23
when i set the page encoding to UTF-8 using <% @page pageEncoding="UTF-8" %> i can read arabic characters correctly in the page but when trying to submit arabic data from this page it's sent in a format like this: صÙÙÙÙÙÙÙرÙ.JPG any ideas why this happens ?
sword101
2010-05-23 10:57:35
You need to set the HTTP request encoding as well. Check the linked article, it's also described in there.
BalusC
2010-05-23 10:59:14
which step in the article please, coz i am new and i am confused
sword101
2010-05-25 07:39:32
The **request encoding**. [Here](http://balusc.blogspot.com/2009/05/unicode-how-to-get-characters-right.html#JSPServletRequest).
BalusC
2010-05-25 11:17:08