The issue was the actual _result2_ is longer then the desired _result2_.
Notice that the actual _result2_ contain many more bytes then the desired. 
I think the issue is that a java string is using unicode/utf16. That's why
there are so many more bytes.

A solution I used was to create a StringWrapper for the _test_ variable and
then use the freemarker ?url method. eg...

<#assign
test=Static["java.lang.String"].format("http://example.com/page?a=1&b=2";) >
<#assign test=StringUtil.wrapString(test)>
<p>result1=${test}</p>
<p>result2=${test?url('utf-8')}</p>

Resulting output to the browser is...
result1=http://example.com/page?a=1&b=2
result2=http%3A%2F%2Fexample.com%2Fpage%3Fa%3D1%26b%3D2 



--
View this message in context: 
http://ofbiz.135035.n4.nabble.com/url-encoding-of-java-string-in-freemarker-template-file-tp4708874p4708920.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to