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
Testing @Postconstruct With Mockito
How to Open Excel File Using JavaScript Code Without Using Activex Control
Javax.Validation - Allow Null But Validate If the Value Is Not
How to Query Multiple Hash Keys in Dynamodb
Java: How to Ask User If He/She Wants to Continue Program
Find Value for a Key from a Dynamic Json Using Java
Java.Sql.Sqlexception: Access Denied for User 'Root'@'Localhost' (Using Password: Yes)
Is There a Simpler Way to Check Multiple Values Against One Value in an If-Statement
Mock Objects Created Inside Method Under Test to Verify the Arguments Passed
How to Pass a List and a Separate String Using @Requestbody in Springboot
Set Layout Width Percentage of the Total Screen Width
How to Display Pdf Inside Webview in Android
Creating a Composite Unique Constraints on Multiple Columns
Remove Parentheses, Dashes, and Spaces from Phone Number
How to Post Form Data With Spring Resttemplate
How to Check Type of Variable in Java
Dynamically Change Application.Properties Values in Spring Boot
How to Set Environment Variable or System Property in Spring Tests