#1
  1. a lazy guy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Hong Kong
    Posts
    99
    Rep Power
    14

    Javascript: Charset


    I have a html file START.HTML which will create two frames at the very begining.
    eg.
    --------------------------------------------------------------------
    <HTML>
    <HEAD>
    <meta http-equiv="Content-Type" content="text/html; charset=big5">
    </HEAD>
    <FRAMESET COLS="250,*" frameborder="NO" framespacing="0" border="0" onload="start()">
    <FRAME NAME="treeFrame" SRC="../html_big5/preload.html" frameborder="Yes" noresize SCROLLING="Auto">
    <FRAME NAME="pageFrame" SRC="../html_big5/preload.html" SCROLLING="Auto" noresize>
    <noframes>
    </noframes>
    </frameset>
    </html>
    --------------------------------------------------------------------

    as you can see, the frameset will execute a function start() after the creation of frames.
    the preload.html is indeed a very simply html like this:
    --------------------------------------------------------------------
    <HTML>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=big5">
    </head>
    <BODY BGCOLOR='#FFFFFF'>
    </BODY>
    </HTML>
    --------------------------------------------------------------------

    note that both START.HTML and preload.html are assigned the charset BIG5.
    Now, the function start() will start writing html to the frame treeframe:

    eg.
    ----------------------------------------------------------------------
    outputFrame = top.treeFrame.window.document; outputFrame.writeln("<HTML>");
    outputFrame.writeln("<HEAD>");
    outputFrame.writeln("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=big5\"/>");
    outputFrame.writeln("<HEAD>");
    ...
    ...
    ...

    ----------------------------------------------------------------------

    The frame 'treeframe' is using the charset 'iso-8859-1' instead of 'big5'. Anyone know what cause the problem?

    Im using Netscape 4.7.
  2. #2
  3. a lazy guy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Hong Kong
    Posts
    99
    Rep Power
    14

    a simple example


    here is a more simple example.
    the following code cannot print the 'big5' chars correctly in netscape 4.7

    note: preload.html is a blank html
    ----------------------------------------------------------------
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=big5">
    <script>
    function test()
    {
    var aliasUrl = "preload.html";
    AliasPopUpWin = window.open(aliasUrl,'docAliasWin','toolbar=no,location=no,scrollbars=yes,status=no,width=400,height =500');

    outputFrame = top.AliasPopUpWin.window.document;
    outputFrame.charset="big5";
    outputFrame.open("text/html");
    outputFrame.write("<HTML>\n");
    outputFrame.write("<HEAD>\n");
    outputFrame.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=big5\">\n");
    outputFrame.write("</HEAD>\n");
    outputFrame.write("žÍ╣¤└╔\n");
    outputFrame.write("</HTML>\n");
    outputFrame.close();
    }
    </script>
    </head>
    <a href="javascript:test()">tesT</a>
    </html>

IMN logo majestic logo threadwatch logo seochat tools logo