Skip to content

ResourcePropertySource class should support to specify character encoding [SPR-13881] #18454

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
spring-projects-issues opened this issue Jan 22, 2016 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jan 22, 2016

rexli opened SPR-13881 and commented

When i use @PropertySources to load my properties file, i found that i can not specify character encoding.

Here is org.springframework.core.io.support.ResourcePropertySource source code:

public ResourcePropertySource(String name, Resource resource) throws IOException {
		super(name, PropertiesLoaderUtils.loadProperties(new EncodedResource(resource)));
		this.resourceName = getNameForResource(resource);
}

I want to specify character encoding like that:

PropertiesLoaderUtils.loadProperties(new EncodedResource(resource, "UTF-8"))

Affects: 4.1.7

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jan 26, 2016

Juergen Hoeller commented

For programmatic use of ResourcePropertySource, we already support a constructor variant with an EncodedResource argument; see #14729. We don't expose it in the @PropertySource annotation yet, which we're tracking in #18447.

In any case, I'll mark this one as a duplicate.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants