[
https://issues.apache.org/jira/browse/SLING-4522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan Seifert closed SLING-4522.
---------------------------------
> Sling Mocks: Contentloader fails for UTF8 encoded json files on Windows
> Systems
> -------------------------------------------------------------------------------
>
> Key: SLING-4522
> URL: https://issues.apache.org/jira/browse/SLING-4522
> Project: Sling
> Issue Type: Bug
> Components: Testing
> Affects Versions: Testing Sling Mock 1.2.0
> Reporter: Alexander Muthmann
> Assignee: Stefan Seifert
> Fix For: Testing Sling Mock 1.3.0
>
> Attachments: SLING-4522.diff
>
>
> The Sling Mock package allows developers to load content from a json file
> using the ContentLoader.
> {code}
> ContentLoader.json(JSON_PATH, TARGET)
> {code}
> The actual loading is performed in ContentLoader.java:327 using
> {code}
> IOUtils.toString(inputStream);
> {code}
> As soon as you try to load a UTF-8 encoded JSON (as per default) on a windows
> platform, this fails due to encoding issues:
> {code}
> "jcr:title": "English Ö",
> {code}
> is loaded as
> {code}
> English [Ö]
> {code}
> As json is per definition UTF-8 encoded, I would suggest to set the encoding
> explicit by changing the line above to
> {code}
> return IOUtils.toString(inputStream, "UTF-8");
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)