473,322 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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=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
2 5472

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Thomas | last post by:
Hi there, a while ago, I posted a question regarding reading japanese text from a text file. Well, since I solved the problem, I thought I'd post my solution for the benefit of other people with...
0
by: Majordomo | last post by:
-- >>>> --36742377 **** Command '--36742377' not recognized. >>>> Content-Type: text/plain; charset=us-ascii **** Command 'content-type:' not recognized. >>>> Content-Transfer-Encoding: 7bit...
0
by: Matthew Simoneau | last post by:
I'm trying to figure out how to HTML encode shift_jis text and put it into an attribute. Starting with this XML-file with characters encoded in shift_jis <?xml version="1.0"...
7
by: Christian Schmitt | last post by:
Hi, I want to write a script that (run from a file on the local HD) reads another local html-file into a variable, then make some changes to it, and then output the result in a way that makes it...
3
by: Benoit Martin | last post by:
in my windows app, I have some japanese text that I load from a text file and display on a label. No matter what type of encoding I try to use on the text file, the text always comes up as a bunch...
3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
8
by: Claude Yih | last post by:
Hi, everyone. The other day I wrote a piece of code to see how the UTF-8 text file was saved in the memory. Although the code worked seemingly well, I still cannot understand a problem about the...
2
by: Bina | last post by:
hi, I want to read & write a html file which contain the japanese character. Now how i will do it?I can read & write english character . but when i read & write Japanese character from the html...
11
by: pardesiya | last post by:
Friends, I am having trouble displaying Japanese text within a textbox (or anywhere else) in an aspx page with .net 2.0 framework. Initial default text in Japanese displays perfectly but when I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.