如何添加 latin5 字符?

How can i add latin5 character?

如何添加 latin5 字符? Oracle网站上不清楚

properties file

Properties.load(InputStream inStream) 的 Javadoc 说:

The input stream is in a simple line-oriented format as specified in load(Reader) and is assumed to use the ISO 8859-1 character encoding; that is each byte is one Latin1 character. Characters not in Latin1, and certain special characters, are represented in keys and elements using Unicode escapes as defined in section 3.3 of The Java™ Language Specification.

这意味着,例如

All_Axes=Tüm Eksenler

应该是

All_Axes=T\u00FCm Eksenler

但是,如果您可以控制 属性 文件的读取方式,则可以改用 Properties.load(Reader reader)。这样,您可以控制字符集,您的文件将按原样工作:

Properties props = new Properties();
try (Reader in = new InputStreamReader(new FileInputStream("/path/to/my.properties"),
                                       "ISO-8859-9"/*or "latin5"*/)) {
    props.load(in);
}