Connecting Tech Pros Worldwide Forums | Help | Site Map

Read from a text file, output to browser in Japanese

David Thomas
Guest
 
Posts: n/a
#1: Jul 17 '05
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=fgets($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
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Read from a text file, output to browser in Japanese



"David Thomas" <davidwhthomas@hotmail.com> wrote in message
news:c9891de0.0406102324.4268389d@posting.google.c om...[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)





R. Rajesh Jeba Anbiah
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Read from a text file, output to browser in Japanese


davidwhthomas@hotmail.com (David Thomas) wrote in message news:<c9891de0.0406102324.4268389d@posting.google. 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
Closed Thread