Read from a text file, output to browser in Japanese

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Thomas

    Read from a text file, output to browser in Japanese

    Hi there,

    I am trying to store data in a text file and output it to the browser
    using PHP. All very easy - if I was using English! the problem is, I
    want to use Japanese and I'm finding it a tad difficult to get PHP to
    understand. I have two files, a text file containing data to display
    and a php file with a script to display the data. I can get the
    contents of a text file displayed in English, no problemo, but in
    Japanese, it's another story...

    All the correct settings are enabled in the php.ini file for Japanese
    language support (mb_string, input_encoding, output_encoding settings
    etc..etc..) even if I save the text file, to be read from, in
    Shift_JIS encoding - I still can't get it to display normally!

    here's the script I'm using to read the text file :

    <?
    $filename="test .txt";
    $fp = fopen($filename ,'r');
    while($line=fge ts($fp))
    {

    //output text file line
    print $line."<br>";

    }
    fclose($fp);
    ?>

    any suggestions?

    thanks very much,

    I would love it if PHP could understand Japanese...

    David Thomas.
  • Gerard van Wilgen

    #2
    Re: Read from a text file, output to browser in Japanese


    "David Thomas" <davidwhthomas@ hotmail.com> wrote in message
    news:c9891de0.0 406102324.42683 89d@posting.goo gle.com...[color=blue]
    > Hi there,
    >
    > I am trying to store data in a text file and output it to the browser
    > using PHP. All very easy - if I was using English! the problem is, I
    > want to use Japanese and I'm finding it a tad difficult to get PHP to
    > understand. I have two files, a text file containing data to display
    > and a php file with a script to display the data. I can get the
    > contents of a text file displayed in English, no problemo, but in
    > Japanese, it's another story...
    >
    > All the correct settings are enabled in the php.ini file for Japanese
    > language support (mb_string, input_encoding, output_encoding settings
    > etc..etc..) even if I save the text file, to be read from, in
    > Shift_JIS encoding - I still can't get it to display normally![/color]

    Did you specify the character set in the HTML-document? For instance:

    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">

    And if so, does the value of "charset" match the actual encoding of the
    text?


    Gerard van Wilgen
    --
    www.majstro.com (On-line translation dictionary / Enreta tradukvortaro)
    www.travlang.com/Ergane (Free translation dictionary for Windows / Senpaga
    tradukvortaro por Windows)





    Comment

    • R. Rajesh Jeba Anbiah

      #3
      Re: Read from a text file, output to browser in Japanese

      davidwhthomas@h otmail.com (David Thomas) wrote in message news:<c9891de0. 0406102324.4268 389d@posting.go ogle.com>...[color=blue]
      > Hi there,
      >
      > I am trying to store data in a text file and output it to the browser
      > using PHP. All very easy - if I was using English! the problem is, I
      > want to use Japanese and I'm finding it a tad difficult to get PHP to
      > understand. I have two files, a text file containing data to display
      > and a php file with a script to display the data. I can get the
      > contents of a text file displayed in English, no problemo, but in
      > Japanese, it's another story...[/color]

      <snip>

      Same problem here with Tamil. I couldn't still figure out the
      reason. But, if I'm right, PHP needs the all the files should be in
      same encoding.

      --
      | Just another PHP saint |
      Email: rrjanbiah-at-Y!com

      Comment

      Working...