About Chinese issues in WebWork2

xiaoxiao2021-03-06  94

Some netizens asked: WebWork2 resource bundle mechanism, using Chinese in the resource file, and the view page is garbled. How to solve.

Here is some of my opinions:

1, the view uses JSP

l Webwork2 default is LOCALE = en_us, encoding = ISO-8859-1

l Modify WebWork.properties to make sure web.locale = zh_cn, WebWork2 will automatically constrain into Chinese

l Don't add in the JSP page

<% @ page contenttype = "text / html; charset = GBK"%>

with

This will show it to garbled

l This will display Chinese correctly in the view.

2, the view uses velocity

l Don't set up

L, there is also a problem: Since WebWork.i18N.Encoding = ISO-8859-1 is set in WebWork.properties, use ISO encoding in the browser, it seems garbled, you need to select GB2312 in your browser Code, in order to display Chinese (more trouble)

l Try to set up web.i18n.encoding = GBK, the encoding shown in the browser is gb2312, but Chinese turn becomes garbled (which master has a good solution?)

转载请注明原文地址:https://www.9cbs.com/read-106732.html

New Post(0)