Bug #18318 Updated: fgetcsv() cannot duel with some Chinese characters
| From: | wytsang at cse dot cuhk dot edu dot hk | Date: | Sat, 13 Jul 2002 06:15:51 +0000 |
| Subject: | Bug #18318 Updated: fgetcsv() cannot duel with some Chinese characters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-14053@lists.php.net to get a copy of this message | ||
ID: 18318
Updated by: wytsang@cse.cuhk.edu.hk
Reported By: wytsang@cse.cuhk.edu.hk
-Status: Feedback
+Status: Open
Bug Type: Filesystem function related
Operating System: Windows 98
PHP Version: 4.2.1
New Comment:
Thank you for giving the link. But there may be there is some
misunderstanding.
In the column "OS", I fill in "Windows 98" just mean that the client is
Windows 98. However, the server is UNIX. And I am not the administrator
so that I cannot change the installation of PHP.
Previous Comments:
------------------------------------------------------------------------
[2002-07-12 18:05:06] sniper@php.net
Try this snapshot:
http://snaps.php.net/win32/php4-win32-latest.zip
------------------------------------------------------------------------
[2002-07-12 12:42:37] wytsang@cse.cuhk.edu.hk
The eg. program of my previous post shows
the bugs.
The desire output is
±ç¤ÖÁø-¤k
However, the actual output is
±ç¤Ö?-¤k
------------------------------------------------------------------------
[2002-07-12 12:37:08] wytsang@cse.cuhk.edu.hk
I find that the function fgetcsv() cannot duel with
Chinese characters "Áø" and "½÷" before comma ",".
I solve the problem by using fgets() and split()
instead of fgetcsv().
<?php
# artist.csv is a file with only one line
# the line is "±ç¤ÖÁø,¤k"
$fp = fopen ("artist.csv", "r");
while ($data = fgetcsv ($fp, 1000, ","))
{
echo $data[0]."-".$data[1];
/*
We find that the last Chinese char of $data[0]
"Áø" is displayed as "?"
*/
}
fclose($fp);
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18318&edit=1