faqts : Computers : Programming : Languages : JavaScript : Windows

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

28 of 29 people (97%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

How can I include accented letters (eg a c cedilla) in the text that appears in an alert box? using: alert('some text'); ?

Mar 30th, 2000 02:13
Martin Honnen, Bart Hoeksel, William van Zwanenberg, http://www.nedcom.nl/it/images/characters.gif


The preferred way for doing this in JavaScript1.2+ is using
  String.fromCharCode(charCode)
e.g.
  alert('libert' + String.fromCharCode(233))
Starting with JavaScript 1.3 you can also use unicode escape sequences 
in the form
  '\uDDDD'
where DDDD is the four digit hexadecimal unicode e.g.
  alert('libert\u00E9')
For older browsers see
http://www.faqts.com/knowledge-base/view.phtml/aid/1621/fid/146/lang/
Here is a list of characters with the ISO character code both given as 
a decimal and hexadecimal number:
   160(A0):  
   161(A1): ¡
   162(A2): ¢
   163(A3): £
   164(A4): ¤
   165(A5): ¥
   166(A6): ¦
   167(A7): §
   168(A8): ¨
   169(A9): ©
   170(AA): ª
   171(AB): «
   172(AC): ¬
   173(AD): ­
   174(AE): ®
   175(AF): ¯
   176(B0): °
   177(B1): ±
   178(B2): ²
   179(B3): ³
   180(B4): ´
   181(B5): µ
   182(B6): ¶
   183(B7): ·
   184(B8): ¸
   185(B9): ¹
   186(BA): º
   187(BB): »
   188(BC): ¼
   189(BD): ½
   190(BE): ¾
   191(BF): ¿
   192(C0): À
   193(C1): Á
   194(C2): Â
   195(C3): Ã
   196(C4): Ä
   197(C5): Å
   198(C6): Æ
   199(C7): Ç
   200(C8): È
   201(C9): É
   202(CA): Ê
   203(CB): Ë
   204(CC): Ì
   205(CD): Í
   206(CE): Î
   207(CF): Ï
   208(D0): Ð
   209(D1): Ñ
   210(D2): Ò
   211(D3): Ó
   212(D4): Ô
   213(D5): Õ
   214(D6): Ö
   215(D7): ×
   216(D8): Ø
   217(D9): Ù
   218(DA): Ú
   219(DB): Û
   220(DC): Ü
   221(DD): Ý
   222(DE): Þ
   223(DF): ß
   224(E0): à
   225(E1): á
   226(E2): â
   227(E3): ã
   228(E4): ä
   229(E5): å
   230(E6): æ
   231(E7): ç
   232(E8): è
   233(E9): é
   234(EA): ê
   235(EB): ë
   236(EC): ì
   237(ED): í
   238(EE): î
   239(EF): ï
   240(F0): ð
   241(F1): ñ
   242(F2): ò
   243(F3): ó
   244(F4): ô
   245(F5): õ
   246(F6): ö
   247(F7): ÷
   248(F8): ø
   249(F9): ù
   250(FA): ú
   251(FB): û
   252(FC): ü
   253(FD): ý
   254(FE): þ
   255(FF): ÿ
   8364(20AC): €
See for a list of characters: 
http://www.nedcom.nl/it/images/characters.gif