Eclipse wrong Java properties UTF-8 encoding

前端 未结 5 2073
南旧
南旧 2020-12-28 15:19

I have a JavaEE project, in which I use message properties files. The encoding of those file is set to UTF-8. In the file I use the german umlauts like ä,

5条回答
  •  温柔的废话
    2020-12-28 16:03

    see: a marker such as FFFD (REPLACEMENT CHARACTER) in http://unicode.org/faq/utf_bom.html

    and see native2ascii --help

       -encoding encoding_name
              Specifies the name of the character encoding to be used by the conversion procedure. If this option is not present, then the
              default character encoding (as determined by the java.nio.charset.Charset.defaultCharset method) is used. The encoding_name
              string must be the name of a character encoding that is supported by the JRE. See Supported Encodings at
              http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html
    

    a case

    $ file yourfile.properties
    yourfile.properties : ISO-8859 text, with very long lines
    $ native2ascii -encoding ISO-8859-1 yourfile.properties yourfile.properties 
    

提交回复
热议问题