OFBiz with HtmlEncoder

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

OFBiz with HtmlEncoder

Rong Nguyen
Hi,
OFBiz use HtmlEncoder:
  public static class HtmlEncoder implements SimpleEncoder {
        public String encode(String original) {
            return
StringUtil.defaultWebEncoder.encodeForHTMLAttribute(original);
        }
    }

and before return to client side, every String is processed by
using: StringUtil.htmlEncoder.encode(<String is here>);

The issue is the encoder encode every unicode character, for example:
The string: "Quản trị" will be encoded as “Qu&#7843;n&#32;tr&#7883;&#32;”
The browser display fine but javascript will know as “Q
u&#7843;n&#32;tr&#7883;&#32;”
We can use StringUtil.wrapString but OFBiz have a lot of services,ftl... to
update
Is there anyway to solve this issue?
What happen if we replace "return
StringUtil.defaultWebEncoder.encodeForHTMLAttribute(original);" by "return
original" ?
Rong Nguyen

Olbius JSC
Deliver highest business value
http://www.olbius.com/