How to use UTF-8 in resource properties with ResourceBundle

后端 未结 16 2223
难免孤独
难免孤独 2020-11-22 03:28

I need to use UTF-8 in my resource properties using Java\'s ResourceBundle. When I enter the text directly into the properties file, it displays as mojibake.

16条回答
  •  终归单人心
    2020-11-22 03:44

    For what it's worth my issue was that the files themselves were in the wrong encoding. Using iconv worked for me

    iconv -f ISO-8859-15 -t UTF-8  messages_nl.properties > messages_nl.properties.new
    

提交回复
热议问题