See other JS stuff
HtmlEncode.js converts non-Ascii characters (>128) to html entities. For xml use numeric entities.
cEncode.js doubles up quotes in a string (useful for all programming languages). The encode method does not put the enclosing quotes around. The encodeLiteral method (specifically for C @literal strings) does put an enclosing double quote around.