Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Japanese characters in JavaScript


Message #1 by "Hanako Matarai" <hanakom@s...> on Fri, 2 Aug 2002 07:15:56
> Hello,
> 
> Does somebody know how to write Japanese characters in 
> JavaScript popup 
> (alert) window?
> 
> Could you help me with any info?
> 
> Thanks in advance.
> 
> Hanako

JavaScript 1.4 and ECMAScript are all compatible with Unicode.  So, type
your text and save your file as UTF-8.  Don't forget to put this line in the
header:
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

If your editor doesn't support Unicode (saving), it's possible to use
Unicode escape sequence in string literal, eg \u30A2 for Katana Letter "A".
For example,
alert ("\u308F\u305F\u3057")
but I admit that it's a pain to do like this !

Fong

  Return to Index