开发者

How to show foreign characters using JSTL/EL?

I am printing foreign 开发者_开发知识库data using JSTL <c:out> tag. The ${data} contains foreign characters. But it's not showing properly. Is there any parser to show foreign characters? Or any other way?


Put this in top of your JSPs.

<%@page pageEncoding="UTF-8" %>

It will set the response encoding and instruct the webbrowser by the proper response headers to interpret it as such.

You only need to ensure that "foreign data" is been encoded in UTF-8. So if the source is a SQL database, ensure that the DB and table use UTF-8. Or if the source is a text file, ensure that it's been saved and read as UTF-8.

See also:

  • Unicode - How to get the characters right?
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜