Escaping HTML Character Entities in Javascript - ''' and '''
This blog has become a chronicle of wierdo bugs, so here's a new one to me. Maybe its not even a bug; but its annoying. I always thought that encoding HTML character entities in Javascript was a no-brainer until we ran across this bug tonight when launching a French version of a Yahoo! property. French language contains lots of apostrophe's (je t'aime, ce n'est pas, etc) and much to our dismay the HTML character entities for apostrophes, both ' and ' both seem to be automagically parsed as apostrophes and not special characters by Javascript, so instead of pulling out your hair trying to figure out why your code is broken, just escape the HTML entities like any other apostrophe would be. You can see for yourself with this little test right here. The first one is the escaped version... Second is not escaped and produces the error. You can do a view source if you don't believe me!
