Publish HTML entities?

Apologies if this has been asked and answered somewhere; I tried searching for information and had no luck.

We are using Rhythmyx 6.5.2

We’re having trouble publishing HTML character entities. When I peek in the Rhythmyx repository database, the field in question has special characters encoded as they were entered, using the numeric character entities. But when the content items containing the field are assembled, if I view the source on the page, the actual character is there rather than the numeric entity.

I’ve tried playing around with the Character Set on the template, but have had no luck.

Also, in case it matters, the field in question is one that we use the EditLive control for editing.

Anyone have any advice as to how to get the character entities to end up in the HTML source of our pages? Any suggestions are appreciated.

I too have run into this issue. I had to use something like:

$sys.item.getProperty('rx:[I]fieldname[/I]').string.replaceAll('\xA0','&nbsp')

Its not exactly clean programming. KWIM?

Is there a better way?

I definitely hope there’s a better way than having to replace each character individually. The sets of characters that should be using their character entities isn’t huge, but it’s more than one or two.

I’m surprised there aren’t more people that have run into this problem. It seems like it’d be fairly standard to want Rhythmyx to publish what was actually entered.

I’m trying out this code:


## macro to escape high-characters in html without encoding the normal characters
## Sam Rushing, October 14, 2009
#macro(htmlEncodeHighCharacters $var $string)##
#set( $builder = $user.psoStringTools.getStringBuilder() )##
#set( $normals = $string.split('[^\x00-\x7F]+') )##
#set( $specials = $string.split('[\x00-\x7F]+') )##
#set( $normalMax = $tools.math.add($tools.list.size($normals),-1) )##
$tools.list.size($normals) $tools.list.size($specials)
#foreach( $i in [0..$normalMax] )##
#if ( $tools.list.size($specials) > $i )##
#set( $xxx = $builder.append($tools.esc.html($tools.list.get($specials,$i))) )##
#end##
#set( $xxx = $builder.append($tools.list.get($normals,$i)) )##
#end##
#set( $var = $builder.toString() )##
#end

Let me know if this works for you. So far, it’s showing some good results here.

You’ll want to remove the live with <code>$tools.list.size($normals) $tools.list.size($specials)</code> if you use this… I had that in for debugging, and forgot to take it out.