Skip to content

Support configurable charset for ResourcePropertySource [SPR-10096] #14729

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 Dec 14, 2012 · 4 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Dec 14, 2012

Sebastien Lorber opened SPR-10096 and commented

In org.springframework.core.io.support.ResourcePropertySource#loadPropertiesForResource

The properties are loaded with:
InputStream is = resource.getInputStream();
props.load(is);

While there should be loaded with:
InputStream is = resource.getInputStream();
InputStreamReader reader = new InputStreamReader(is,charset);
props.load(reader);

And the charset could be added to the constructors, why not with a default UTF-8 charset.

Without that, all property sources loaded with this class are using ISO 8859-1 charset

It seems to affect 3.2 as well because I didn't see any charset in the constructor.


Affects: 3.1.2

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

Good point Sebastien, thanks!

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

This is not quite as trivial as I thought it might be on initial review. Slating for 3.2 Backlog.

@spring-projects-issues
Copy link
Collaborator Author

Sebastien Lorber commented

My implementation is trivial and it seems to work fine for us (at least with UTF-8)
What is the matter?

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I've added overloaded constructors with an EncodedResource argument (basically a combination of a Resource with an encoding/charset) to ResourcePropertySource for the upcoming 3.2.1 release.

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) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants