Utf-8 Encoding of Application.Properties Attributes in Spring-Boot

UTF-8 encoding of application.properties attributes in Spring-Boot

As already mentioned in the comments .properties files are expected to be encoded in ISO 8859-1. One can use unicode escapes to specify other characters. There is also a tool available to do the conversion. This can for instance be used in the automatic build so that you still can use your favorite encoding in the source.

Spring Boot default properties encoding change?

Apparently properties loaded by Spring Boot's ConfigFileApplicationListener are encoded in ISO 8859-1 character encoding, which is by design and according to format specification.

On the other hand, the .yaml format supports UTF-8 out of the box. A simple extension change fixes the problem for me.

Spring Boot: How do I load application.properties files with UTF-8

JAVA hold all string in memory with unicode instead of its own encoding. So the importance is to tell java how to load string in correct encoding. Most common solution (i18n use this way) is to translate chinese into unicode, which java can handle it directly.

Here is an online tool to translate chinese to unicode. Hope this helps.

SpringBoot - UTF-8 Doesnt work in messages.properties

To read any file in the UTF-8 encoding it must be created in the UTF-8 before.

Use some editor which supports encoding switching. Or create that file from IDE with encoding option for properties files. E.g. IDEA: http://blog.jetbrains.com/idea/2013/03/use-the-utf-8-luke-file-encodings-in-intellij-idea/

Spring Boot default properties encoding change?

Apparently properties loaded by Spring Boot's ConfigFileApplicationListener are encoded in ISO 8859-1 character encoding, which is by design and according to format specification.

On the other hand, the .yaml format supports UTF-8 out of the box. A simple extension change fixes the problem for me.



Related Topics



Leave a reply



Submit