Page 1 of 1

reading unicode tab delimited text file in php

Posted: Sun Oct 28, 2007 7:40 pm
by jimthunderbird
Hi All,
Recently I'm involved with a task to read a tab delimited text file in unicode and then convert them into a series of sql insert statements and then insert to mysql db.

I've successfully done the similar thing in the past with the text in ASCII using php's fgetcsv, but this time it does not work for this unicode file. In the file it has some funny characters like '®'.

Anyone had some hints on this?

Thank you very much.

Best Regards,
jim

Posted: Sun Oct 28, 2007 8:50 pm
by s.dot
explode() on tabs (\t) ?

edit| or do you mean the characters are giving you problems? you can run html_entities() on it with the charset set

Posted: Mon Oct 29, 2007 2:08 am
by jimthunderbird
Hi,
I think my problem nails down to these two lines of code, it doesn't seem to work:

Code: Select all

$content = str_replace("®","®","®123");
     print $content;
Do you have any hints on it?

Thanks.

Best Regards,
Jim