convert html speciale characters to htmlentities
Author: c.tamietto@pokerspa.it (c.tamietto)
I have stored in a database field a html content . then i need to translate speecial characters to html entities . I've tried in this way : p_html_entities = $replace(p_html_entities, 1, "‘", "‘", -1) p_html_entities = $replace(p_html_entities, 1, "’", "’", -1) p_html_entities = $replace(p_html_entities, 1, "“", "“", -1) p_html_entities = $replace(p_html_entities, 1, "”", "”", -1) p_html_entities = $replace(p_html_entities, 1, "•", "•", -1) p_html_entities = $replace(p_html_entities, 1, "–", "–", -1) p_html_entities = $replace(p_html_entities, 1, "™", "™", -1) is there a better way to do this job ? i've tried the functions $decode and $tometa but it doesn't work thank you for any answer

You could, however, use (e.g.) a loop like this: for i = 128 to 255 p_html_entities = $replace(p_html_entities, 1, $string($concat("&#", i, ";")), $concat("&#", i, ";"), -1) endfor But maybe Iain was trying to hint at this? This is of course only useful if the html content is not "too big" (otherwise this most likely will have a negative impact on performance). Hope this helps.