Bug #18318 Updated: fgetcsv() cannot duel with some Chinese characters

From: Date: Fri, 12 Jul 2002 22:05:07 +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-14026@lists.php.net to get a copy of this message
ID: 18318 Updated by: sniper@php.net Reported By: wytsang@cse.cuhk.edu.hk -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: Windows 98 PHP Version: 4.2.1 New Comment: Try this snapshot: http://snaps.php.net/win32/php4-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#14026) next »