Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3739

Freemarker ?url builtin doesn't work in Magnolia

XMLWordPrintable

    • Yes
    • Yes

      Steps to reproduce:

      1. Use the url built-in to render a variable in a freemarker template ("title?url", for example)

      Expected result:

      The template should output a URL-encoded version of the title variable

      Actual result:

      To do URL encoding, the framework that encloses FreeMarker must specify the output encoding or the URL encoding charset, so ask the programmers to fix it. Or, as a last chance, you can set the url_encoding_charset setting in the template, e.g. <#setting url_escaping_charset='ISO-8859-1'>, or give the charset explicitly to the buit-in, e.g. foo?url('ISO-8859-1').
      The problematic instruction:
      ----------
      ==> ${title?url} [on line 62, column 9 in templating-kit/templates/global/mainAreaIntro.ftl]
       in include def.mainArea.intro.template [on line 2, column 5 in templating-kit/templates/global/mainArea.ftl]
       in include "../global/mainArea.ftl" [on line 4, column 5 in templating-kit/templates/content/mainArea.ftl]
       in include def.mainArea.template [on line 48, column 21 in templating-kit/templates/main.ftl]
      ----------
      

      One can work around this by setting the encoding in the template, but one shouldn't have to.

      Patch with fix and test case included.

        Acceptance criteria

              ochytil Ondrej Chytil
              seanmctex Sean McMains
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD