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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 03:01:28 2024 UTC