@PropertySource and UTF-8 properties file

前端 未结 6 620
广开言路
广开言路 2020-12-20 23:11

Is it possible, using @PropertySource annotation, to configure the encoding that has to be used to load the property file?

An example to clarify my prob

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-20 23:51

    .properties files are per definition ISO-8859-1 encoded. So I'm afraid you can't do that.

    You can however use \uXXXX unicode escapes to represent any unicode character you want. The (slightly misnamed) native2ascii tool can help with automatically doing that.

提交回复
热议问题