You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (JIRA)" <ji...@apache.org> on 2015/03/19 13:15:38 UTC

[jira] [Resolved] (SLING-4522) Sling Mocks: Contentloader fails for UTF8 encoded json files on Windows Systems

     [ https://issues.apache.org/jira/browse/SLING-4522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seifert resolved SLING-4522.
-----------------------------------
    Resolution: Fixed

Completed: At revision: 1667720  

added unit test and fixed in snapshot 1.2.1-SNAPSHOT, please validate

> 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.2.2
>
>         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)