Uploaded image for project: 'Hippo Site Toolkit 2'
  1. Hippo Site Toolkit 2
  2. HSTTWO-3394

Backport 3.0.1 : Make sure when a FTL is read from the repository as binary, it is done so with encoding UTF-8

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.1
    • Component/s: None
    • Labels:
    • Similar issues:

      Description

      When binaries are read from the repository and converted to a string, this should be done using UTF-8 encoding. This is currently not the case which can result in issues on Windows OS

      From Jeroen Reijn:

      "We noticed that the jcr:content node did contain a jcr:mimeType property (set to application/octet-stream), but is lacking the jcr:encoding property.

      Now because it did work on my machine we assumed that it wasn't in the code that synchronized this, but it had to be somewhere else.

      Setting the file.encoding was a hunch, but later I tracked it down to:

      org.hippoecm.hst.freemarker.jcr.TemplateLoadingCache#createRepositorySourceFromBinary

      Where the inputstream of the file is copied to a String. We use

      String template = IOUtils.toString(stream);

      Now looking at the Javadoc explains what happens:

      Get the contents of an <code>InputStream</code> as a String

      • using the default character encoding of the platform.

      So on windows that's not UTF-8 hence it broke."

      Thanks Jeroen for tracing down this issue! Nice catch!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pgupta Pankaj Gupta (Inactive)
                Reporter:
                aschrijvers Ard Schrijvers
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: