php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18318 fgetcsv() cannot duel with some Chinese characters
Submitted: 2002-07-12 12:37 UTC Modified: 2002-07-13 02:41 UTC
From: wytsang at cse dot cuhk dot edu dot hk Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.2.1 OS: Windows 98
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wytsang at cse dot cuhk dot edu dot hk
New email:
PHP Version: OS:

 

 [2002-07-12 12:37 UTC] wytsang at cse dot cuhk dot edu dot 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);
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-12 12:42 UTC] wytsang at cse dot cuhk dot edu dot 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 18:05 UTC] sniper@php.net
Try this snapshot:

http://snaps.php.net/win32/php4-win32-latest.zip

 [2002-07-13 02:15 UTC] wytsang at cse dot cuhk dot edu dot hk
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.
 [2002-07-13 02:41 UTC] sniper@php.net
I get this with 4.3.0-dev:

??????-?k

So I guess this is fixed.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 17:01:30 2025 UTC