SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2002
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Chinese characters in Alert?

    Hi,

    I've got a chinese version of a site that I've translated everything except the Alert boxes.

    Here's the English version:

    <script language="JavaScript">
    function validateForm(part_search) {
    var partsearch = part_search.partsearch.value;

    if (partsearch == "") {
    alert("Please insert a Part Number.");
    return false; }
    return true;}
    </script>


    Please insert a Part Number = 请输入型号

    So.. I've tried both decimal values (#35831;#36755;#20837;#22411;#21495; ....Removed &'s or else this interface will display Chinese characters)


    <script language="JavaScript">
    function validateForm(part_search) {
    var partsearch = part_search.partsearch.value;

    if (partsearch == "#35831;#36755;#20837;#22411;#21495;") {
    alert("");
    return false; }
    return true;}
    </script>

    This just displays raw #35831;#36755;#20837;#22411;#21495;

    and Unicode:

    <script language="JavaScript">
    function validateForm(part_search) {
    var partsearch = part_search.partsearch.value;

    if (partsearch == "") {
    alert("\u8BF7\u8F93\u5165\u578B\u53F7");
    return false; }
    return true;}
    </script>

    This displays boxes...

    What am I doing wrong??

    Thanks

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, it doesn't appear that you can. I know that for Chinese you need to be using the Big5 encoding and have the language pack installed (or a native install). I did both of those and tried your code with both unicode and ascii escapes, but always get the boxes.

    I'll have to reasearch this -- maybe per the ECMA spec, javascript only supports certain character sets.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •