Skip to content

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

Closed

Description

@spring-projects-issues

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:

Activity

  1. spring-projects-issues commented on Dec 18, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    Good point Sebastien, thanks!

  2. spring-projects-issues commented on Jan 22, 2013

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

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

  3. spring-projects-issues commented on Jan 22, 2013

    @spring-projects-issues
    CollaboratorAuthor

    Sebastien Lorber commented

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

  4. spring-projects-issues commented on Jan 23, 2013

    @spring-projects-issues
    CollaboratorAuthor

    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

  5. added
    type: enhancement
    in: core
    on Jan 11, 2019
  6. added this to the 3.2.1 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions