php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31632 fgetcsv() doesn't handle unicode documents correctly
Submitted: 2005-01-21 13:01 UTC Modified: 2005-01-21 15:32 UTC
From: nickmc at codemasters dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.9 OS: Windows 2000 Professional
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: nickmc at codemasters dot com
New email:
PHP Version: OS:

 

 [2005-01-21 13:01 UTC] nickmc at codemasters dot com
Description:
------------
Reading from a unicode-encoded text file with fgetcsv() works almost as intended, but each string in the resulting array contains a space after each character.

Reproduce code:
---------------
The string (saved as a unicode text file, tab delimited):
"hello, this is a text file	1	2	3	4	5	6"

Read using:
$data = fgetcsv ($fp, 1000, "\t")

Expected result:
----------------
You'd expect the output to be the same as if the file was ANSI format.

Actual result:
--------------
Browser output from a print_r($data) (looks OK):
Array ( [0] => hello, this is a text file [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 [6] => 6 )

Page HTML:
Array
(
    [0] => h e l l o ,   t h i s   i s   a   t e x t   f i l e 
    [1] =>  1 
    [2] =>  2 
    [3] =>  3 
    [4] =>  4 
    [5] =>  5 
    [6] =>  6 
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-21 13:07 UTC] nickmc at codemasters dot com
I've since read that PHP has no unicode support, so I'd guess that's the reason.
 [2005-01-21 15:32 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

No unicode support in PHP's standard string functions.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 08:01:30 2025 UTC