Struts application.properties文件不支持重音字符 [英] Struts application.properties file is not supporting accented characters

查看:102
本文介绍了Struts application.properties文件不支持重音字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在struts application.properties中,我们有键和值对.我们使用此文件在浏览器的html/jsp页面上显示静态文本.

In struts application.properties we have key and value pairs. We use this file to display static text on html/jsp pages in browser.

但是当我从以下位置输入德语字符时: http://www.w3schools .com/tags/tryit.asp?filename = tryhtml_script_charset

But when I entered German characters from : http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_script_charset

输入了此文本:希腊语符号αβγδεζηθ

entered this text : αβγδεζηθ (Greek Symbols)

在html页面的某个按钮上,它显示了一些不同的字符:

at some button in html page, it shows some different characters:

注意:在这种情况下,我使用文件编码为UTF-8,然后编译代码.

Note : i have used file encoding as UTF-8 in this case, and then compile the code.

我还应该怎么做以支持这些字符.请提供一些链接,以便有所帮助.

What should i do to support these characters also. Please give some links so that it would be helpful.

谢谢....

推荐答案

某些字符无法按原样存储在属性文件中,必须使用Unicode转义字符输入:

Some characters cannot be stored AS IS on the properties file, it will have to entered using Unicode escape characters:

属性文件的默认编码为ISO-8859-1,也称为Latin-1字符.然后必须使用Unicode转义字符输入所有非拉丁1字符.

The default encoding for property files is ISO-8859-1 also known as Latin-1 characters. All non-Latin-1 characters must then be entered using Unicode escape characters.

示例,请考虑以下使用法语句子的示例:

Example, consider the following example using a french sentence:

#property file example:
sentence.french=Son père est allé à l'hôtel.

某些重音符号不属于Latin-1字符集.因此,将其转义为其Unicode转义字符,我们得到:

There are certain accents that are not part of the Latin-1 character set. Therefore, escaping it to its Unicode escape characters, we get:

#property file example:
sentence.french=Son p\u00e8re est all\u00e9 \u00e0 h\u00f4tel.

  • 来源.
    • Source.
    • 我希望这会有所帮助.

      这篇关于Struts application.properties文件不支持重音字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆