How can I improve this?
<p>[http://83.80.140.99/jp/index.php]</p>

<p>At the moment I am trying to create a japanese rehearsal system, and its working perfectly. However, I am not pleased with the code. Basically I had a .txt file called lesson1.txt. I saved it as UTF-8 so it can contain japanese characters. </p>

<p>I had the problem I couldn't directly use the japanese characters in javascript, so I tried bypassing that issue by finding the unicode code point of each character in php, echo that out in as a javascript array and use a javascript function to convert it back to the japanese characters. </p>

<p>Now I figured this is not the way to go, because someone on this site told me this is an awful way of coding. My question is, how do I go by improving this? How can I get the japanese characters into my javascript code the most efficient way? Also, have a look at how badly it is coded right now to get a better way of understanding my problem. The link is at the top.</p>

<p>In case necessary: I used this php loop to get each unicode point transfered into characters and saved into a javascript array:</p>

<pre><code>$x = 0;
//$LineArray is an array in which each element contains a line of  lesson1.txt
    // so for example: $LineArray[0] = "あつい";
foreach($LineArray as $s)
{
    echo "TextCharacters[" . $x . "] = new Array();\n";
    for($i = 0; $i &lt; mb_strlen($s,"utf-8"); $i++)
    {
        $char = mb_substr($s, $i, 1, "utf-8");
                    // REMOVE BOM
        if(strtoupper(bin2hex(iconv('UTF-8', 'UCS-2', $char))) != "FEFF") 
        {
                    echo "TextCharacters[" . $x . "].push(go(\"" .   strtoupper(bin2hex(iconv('UTF-8', 'UCS-2', $char))) . "\"));\n";   
        }
    }
    $x++;
} 
</code></pre>
