|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2007-03-15 08:33 UTC] websites at mtu-net dot ru
 Description:
------------
When opening an .csv-file with fgetcsv() most part of cyrillic (win-1251) characters disappears, and they are returned as an empty string in returned list. Everything's OK with latin characters.
Reproduce code:
---------------
$fp=fopen("csv.csv","r");
while ($arr=fgetcsv($fp, 1000, ";"))
 {
  *here comes a bunch of outputs*
Expected result:
----------------
Expected: all strings neatly packed in a list =)
Actual result:
--------------
Result: almost all string fields in a list are empty
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 03:00:01 2025 UTC | 
code to reproduce the bug: <?php // setlocale(LC_ALL, 'ru_RU.cp1251'); $row = 1; $handle = fopen("p.csv", "r"); while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . "<br />\n"; } } fclose($handle); ?>