You can use UCM built-in Java methods to Encode and Decode your HTML/XML. This is handy when operating within the WCM realm as well as when working with UCM UI customizations. I’ve uploaded a sample component showing some of this in action on the downloadspage.

This component adds a simple service handler you can execute throught the custom service (ENCODE_DECODE_SAMPLE_SERVICE). The handler takes the content you enter into a textarea an encodes and decodes it then provides those variables for out template to write back to the page as well as dumping some information out to the server output.

String txtEncoded = StringUtils.encodeXmlEscapeSequence(txtOriginal);
SystemUtils.trace("system", "txtEncoded=" + txtEncoded);
String txtDecoded = StringUtils.decodeXmlEscapeSequence(txtOriginal.toCharArray(), 0, txtOriginal.length());
SystemUtils.trace("system", "txtDecoded=" + txtDecoded);
Picture
 


Comments




Leave a Reply


Redstone Content Solutions