Java 通过Resourcebundle编码问题读取属性文件
我正在使用resourcebundle读取基于区域设置的属性文件。(Lang_en_US.properties,…) resourcebundle被解读为iso-8859-1(标准?) 然后在整个Spring/JSF web应用程序中使用resourcebundle来生成前端文本Java 通过Resourcebundle编码问题读取属性文件,java,character-encoding,Java,Character Encoding,我正在使用resourcebundle读取基于区域设置的属性文件。(Lang_en_US.properties,…) resourcebundle被解读为iso-8859-1(标准?) 然后在整个Spring/JSF web应用程序中使用resourcebundle来生成前端文本 <h:outputText value="#{msg['message.example']}" /> 我相信您假设resourcebundle被读入为iso-8859-1是正确的。 () 您确定您的属性文
<h:outputText value="#{msg['message.example']}" />
我相信您假设resourcebundle被读入为iso-8859-1是正确的。 () 您确定您的属性文件是以iso-8859-1格式保存的吗?
我相信Notepad++提供的功能至少可以检查编码(如果不转换的话)。由于您使用的UTF-8字符可能在ISO-8859-1中编码不正确,因此您有两个选项
谢谢这些提示,非常有用!但是,如果在资源包中使用iso-8859-1导入UTF-8字符,那么UTF-8字符不是已经被弄乱了吗?
<h:outputText value="#{msg['message.example']}" />
// returns gibberish:
log.trace(rb.getMessage("l_SampleText"));