By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,831 Members | 2,296 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,831 IT Pros & Developers. It's quick & easy.

Read from a text file, output to browser in Japanese

P: n/a
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.
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"David Thomas" <da***********@hotmail.com> wrote in message
news:c9**************************@posting.google.c om...
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!


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)

Jul 17 '05 #2

P: n/a
da***********@hotmail.com (David Thomas) wrote in message news:<c9**************************@posting.google. com>...
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...


<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
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.