I'm not sure there is a problem? FreeMarker is doing exactly what you're telling it to do by escaping any URL characters. This behavior is well documented [1]
So I guess the question is, why and in what context are you using the url() built-in for. [1] http://freemarker.org/docs/ref_builtins_string.html#ref_builtin_url On Wed, Jul 26, 2017 at 5:04 AM, Wai <[email protected]> wrote: > In a freemarker template, I have the following. Of course, it can also come > from a java method. > <#assign > test=Static["java.lang.String"].format("http://example.com/page?a=1&b=2") > > <p>result1=${test}</p> > <p>result2=${test?url('utf-8')}</p> > > The output to the webbrowser shows... > result1=http://example.com/page?a=1&b=2 > result2=http%26%23x3a%3B%26%23x2f%3B%26%23x2f%3Bexample.com%26%23x2f%3Bpage%26%23x3f%3Ba%26%23x3d%3B1%26amp%3Bb%26%23x3d%3B2 > > I'm interesting in the following correct output... > result1=http://example.com/page?a=1&b=2 > result2=http%3A%2F%2Fexample.com%2Fpage%3Fa%3D1%26b%3D2 > > > Could someone tell me what is the problem and how to solve it. > Thanks in advance. > > > > > -- > View this message in context: > http://ofbiz.135035.n4.nabble.com/url-encoding-of-java-string-in-freemarker-template-file-tp4708874.html > Sent from the OFBiz - User mailing list archive at Nabble.com.
