decodeURI with a suitable argument; e.g. ñ is decodeURI('%C3%B1')
Example 1: Here is a test for the capital letter U-umlaut (Ü):
document.write('\xDC') //
document.write('Ü') //
document.write('Ü') //
document.write(unescape('%DC')) //
document.write(decodeURI('%C3%9C')) //
Example 2: Here is a test for the Latin OE ligature (Œ):
document.write('\u0152') //
document.write('Œ') //
document.write('Œ') //
document.write(unescape('%u0152')) //
document.write(decodeURI('%C5%92')) //
To display an accented character in a JavaScript alert message or
a confirm dialog box, use the hexadecimal code of the character, for example:
alert('\xC5ngstr\xF6m is a unit of length.') //Try it!
The following table lists the HTML entities, character codes, and URL-encodings for accented Latin letters and ligatures.
(Letters that do not have standard HTML entities are not included. Still, those letters can be rendered,
similar to the above examples, as long as you know the character codes
\xXX or \uXXXX or XX;
e.g. the letters č and ℓ can be rendered using
č and ℓ respectively.)
See also
Greek letters,
Mathematical symbols and
URL-encoding.
|