Skip to content

Properties should be now in UTF-8 #29587

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

Closed
pdemanget opened this issue Jan 28, 2022 · 1 comment
Closed

Properties should be now in UTF-8 #29587

pdemanget opened this issue Jan 28, 2022 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@pdemanget
Copy link

Since java 9, properties should be in UTF-8 unless specifically configured else:
https://docs.oracle.com/javase/9/intl/internationalization-enhancements-jdk-9.htm#JSINT-GUID-974CF488-23E8-4963-A322-82006A7A14C7

The properties Loader still user ISO hardcoded, see this file:
https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java

        CharacterReader(Resource resource) throws IOException {
		this.reader = new LineNumberReader(
				new InputStreamReader(resource.getInputStream(), StandardCharsets.ISO_8859_1));
	}

Would it be possible to use UTF_8 be default?
It would still be configurable sith the environment var
java.util.PropertyResourceBundle.encoding=ISO-8859-1

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 28, 2022
@wilkinsona
Copy link
Member

wilkinsona commented Jan 28, 2022

The change in JDK 9 is specifically for properties-based resource bundles used for internationalization. General loading of properties is not affected and continues to use ISO-8859-1.

#28663 is tracking a configuration option for this or, possibly, a change to Boot's default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants