-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Provide a configuration option to load properties config data files as UTF-8 #28663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What do you mean by wrong? Which charset did you expect to be used and which charset was actually used? Can you provide a minimal sample that reproduces the problem so that we can see exactly what you mean? You can share one with us by zipping it up and attaching it to this issue or by pushing it to a separate repository on GitHub. |
you can try this demo project, all of files are utf8. |
Java's default encoding for properties files is ISO-8859-1 and we deliberately align with this (see #5361 and #10565). As recommended in Properties' javadoc you should use Unicode escapes for non-Latin1 characters. YAML uses UTF-8 by default which is why the value of We can consider offering a setting to load |
Thanks! I understand, this case confused me a long time. |
We'd like to see how the UTF-8 switch planned for Java 18 works out before we do anything in Spring Boot. For now, using YAML seems like the best approach. |
Uh oh!
There was an error while loading. Please reload this page.
It works well when I set my properties in application.yml directly

But when I set these properties in additional file imported by "spring.config.import" like below, its charset is wrong
Is there some options to set charset for "spring.config.import"? Otherwise I have to use
@PropertySource
to set charset, but it do not support yml fileThe text was updated successfully, but these errors were encountered: