wrote:
> I have:
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> in my head (and yes, I need to keep it UTF-8...)
Only if it matches the actual page charset (Unicode), otherwise it is a
call for troubles.
> This works fine, as long as the characters are "normal"... if I try and
> add a chevron (?)for example, it won't work, no matter how I escape
> it.
That's because - as hundreds prior you - you tried all imaginable
escape methods except the right one
JavaScript operates with Unicode and Unicode only; respectively it
doesn't care of HTML entities or ASCII codes. Use Unicode escape
sequences and be happy ever after. Here is a small table of characters
coders around the world are starving for most oftenly (feel like start
charging for it
00A0 no-break space
00A4 currency sign
20AC Euro
00A3 British pound
00A5 Japanese yen
00AB left guillomet
00BB right guillomet
201C left double quote
201D right double quote
2018 left single quote
2019 right single quote
Unicode escape sequence has form \uXXXX where XXXX is hex value of
Unicode character.
This way to say make "word" inside guillomets:
var quote = "\u00ABword\u00BB";
And to make a string with non-breaking space:
var nobr = "Word\u00A0Word";
You also can use String.fromCharCode method for numeric values:
var EuroSign = String.fromCharCode(0x20AC);