Question about Chinese in webwork2

Source: Internet
Author: User

1View usageJSP

L webwork2 uses locale = en_us by default, encoding = ISO-8859-1

L modify webwork. properties to ensureWebwork. locale = zh_cn, Webwork2 will be automatically localized to Chinese

L do not add

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

And

<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=GBK">

This will display garbled characters.

L in this way, the Chinese characters can be correctly displayed in the view.

 

2View usageVelocity

L no need to set

L but there are also problems: Due to the webwork. properties settingWebwork. i18n. Encoding = ISO-8859-1So the ISO encoding is used by default for display in the browser. It looks garbled. You need to select gb2312 encoding in the browser to display Chinese properly (relatively troublesome)

L tried to set webwork. i18n. Encoding = GBK. the browser showed that the encoding was gb2312, but the Chinese character turned into garbled characters (which expert has a good solution ?)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.