|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
XMLFormatted Characters
Author: Peter Boughton
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58441#318931
Don't destroy raw data - only do formatting when outputting.
Also, many people recommend HtmlEditFormat over XmlFormat for outputting to HTML.
So, if you have an original variable HtmlData containing unescaped characters...
- Use HtmlEditFormat(HtmlData) to convert for HTML output.
- And JsStringFormat(HtmlData) to display in a JS alert box.
(although I'm not sure why the JS alert isn't dealing with the entities
properly.)
If you do actually need to convert from HTML entity to actual character... I'd
probably use a Java Regex replace with a callback function. That could fix any
hex or decimal entities easily enough, with just a little bit more effort
required to compile a lookup for named entities.
(If anyone wants to go that route and can't find an existing function, I don't
mind throwing it together (later tonight), but only if I'm not reinventing a
wheel that already exists - i.e. someone search cflib/etc and if there's nothing
on there I'll add one)
Author: Adrian Lynch
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58441#318926
Not a direct answer, but you could not touch the special characters (not
sure why they're called special characters, they're not THAT special!) and
instead use CDATA islands when generating the XML files.
Adrian
----- Excess quoted text cut - see Original Post for more -----
Author: Duane Boudreau
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58441#317447
Hi All,
I?m using XMLFormat to convert special characters in strings to their HTML
equivalents. This works fine as long as the strings are being displayed in
plain HTML but causes problems when I try to output the strings in using an
alert box. Does know how to convert XMLFormatted characters back to their
original form? ex: ó to รณ
Thanks,
Duane
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||