开发者

problem with reading arabic in jsp page?

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 wh开发者_JAVA百科y something like this occur?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜