Found a handy web-based utility for encoding/escaping text in JavaScript: Text Escaping and Unescaping in JavaScript.
Text Escaping and Unescaping in JavaScript
Reply
Found a handy web-based utility for encoding/escaping text in JavaScript: Text Escaping and Unescaping in JavaScript.
Found this article which has a handy ‘escape’ function:
// replace any non-ascii character with its hex code. function escape($value) { $return = ''; for($i = 0; $i < strlen($value); ++$i) { $char = $value[$i]; $ord = ord($char); if($char !== "'" && $char !== "\"" && $char !== '\\' && $ord >= 32 && $ord <= 126) $return .= $char; else $return .= '\\x' . dechex($ord); } return $return; }