How to use UTF-8 in resource properties with ResourceBundle

后端 未结 16 2248
难免孤独
难免孤独 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:52

    We create a resources.utf8 file that contains the resources in UTF-8 and have a rule to run the following:

    native2ascii -encoding utf8 resources.utf8 resources.properties
    

提交回复
热议问题