Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-3393

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 3.1.0
    • None

    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 jreijn:

      "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

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

              Dates

                Created:
                Updated:
                Resolved: