ID: 12127
Comment by: info at netangels dot ru
Reported By: bitlz at mail dot ru
Status: No Feedback
Bug Type: Filesystem function related
Operating System: Windows 2000 Professional
PHP Version: 4.3.1
New Comment:
Guys
The problem still occurs even in PHP 5.2.0 and PHP 5.1.x as well as in
5.0.x but we've found a workaround.
If csv-file is in russian encoding (cp1251) then php-script should do:
setlocale(LC_ALL, "ru_RU");
BEFORE call fgetcsv() if current locale is not ru_RU. If locale is
ru_RU already, it works well on all versions of php from 4.3.x up to
the latest 5.2.0 without requiring setlocale()
Previous Comments:
------------------------------------------------------------------------
[2003-03-09 18:41:00] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
------------------------------------------------------------------------
[2003-02-28 07:25:15] moriyoshi@php.net
And actually bug #21689 is a duplicate of this report...
------------------------------------------------------------------------
[2003-02-28 07:16:20] moriyoshi@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
I've already committed a fix for this issue.
------------------------------------------------------------------------
[2003-02-28 07:13:10] alexws@php.net
Well, reproducing this bug on 4.3.0, 4.3.1
Code:
<?
$fh=fopen('1.csv','rb');
while (!feof($fh)) {
$array[]=fgetcsv($fh,1024,';','"');
}
fclose($fh);
print_r($array);
?>
CSV:
F11;KDV;Äæåéìñ Áîíä. È îäíîãî ìèðà ìàëî;1:53:07;598
;;Plazma - Take My Love;;
F12;Film;Äæåéìñ Áîíä. Çîëîòîé ïèñòîëåò;2:00:15;680
F14;ÌèññèÿÍåâûïîëíèì;Ìèññèÿ íåâûïîëíèìà 2;2:01:53;689
F24;Bedazzled;Îñëåïëåííûé æåëàíèÿìè;1:31:47;672
F27;Ìàðñèàíèí;Ìîé ëþáèìûé ìàðñèàíèí;1:33:31;597
Result:
Array
(
[0] => Array
(
[0] => F11
[1] => KDV
[2] => Äæåéìñ Áîíä. È îäíîãî ìèðà ìàëî
[3] => 1:53:07
[4] => 598
)
[1] => Array
(
[0] =>
[1] =>
[2] => Plazma - Take My Love
[3] =>
[4] =>
)
[2] => Array
(
[0] => F12
[1] => Film
[2] => Äæåéìñ Áîíä. Çîëîòîé ïèñòîë
[3] => 2:00:15
[4] => 680
)
[3] => Array
(
[0] => F14
[1] => èññèÿÍåâûïîëíèì
[2] => èññèÿ íåâûïîëíèìà 2
[3] => 2:01:53
[4] => 689
)
[4] => Array
(
[0] => F24
[1] => Bedazzled
[2] => ñëåïëåííûé æåëàíèÿìè
[3] => 1:31:47
[4] => 672
)
[5] => Array
(
[0] => F27
[1] => àðñèàíèí
[2] => îé ëþáèìûé ìàðñèàíèí
[3] => 1:33:31
[4] => 597
)
[6] =>
)
Looks like it still loses foreign letters. Please REMOVE all foreign
letter checks from FGETCSV. Strange behavior sometimes results in
entire fields being lost.
------------------------------------------------------------------------
[2003-02-28 07:13:06] alexws@php.net
Well, reproducing this bug on 4.3.0, 4.3.1
Code:
<?
$fh=fopen('1.csv','rb');
while (!feof($fh)) {
$array[]=fgetcsv($fh,1024,';','"');
}
fclose($fh);
print_r($array);
?>
CSV:
F11;KDV;Äæåéìñ Áîíä. È îäíîãî ìèðà ìàëî;1:53:07;598
;;Plazma - Take My Love;;
F12;Film;Äæåéìñ Áîíä. Çîëîòîé ïèñòîëåò;2:00:15;680
F14;ÌèññèÿÍåâûïîëíèì;Ìèññèÿ íåâûïîëíèìà 2;2:01:53;689
F24;Bedazzled;Îñëåïëåííûé æåëàíèÿìè;1:31:47;672
F27;Ìàðñèàíèí;Ìîé ëþáèìûé ìàðñèàíèí;1:33:31;597
Result:
Array
(
[0] => Array
(
[0] => F11
[1] => KDV
[2] => Äæåéìñ Áîíä. È îäíîãî ìèðà ìàëî
[3] => 1:53:07
[4] => 598
)
[1] => Array
(
[0] =>
[1] =>
[2] => Plazma - Take My Love
[3] =>
[4] =>
)
[2] => Array
(
[0] => F12
[1] => Film
[2] => Äæåéìñ Áîíä. Çîëîòîé ïèñòîë
[3] => 2:00:15
[4] => 680
)
[3] => Array
(
[0] => F14
[1] => èññèÿÍåâûïîëíèì
[2] => èññèÿ íåâûïîëíèìà 2
[3] => 2:01:53
[4] => 689
)
[4] => Array
(
[0] => F24
[1] => Bedazzled
[2] => ñëåïëåííûé æåëàíèÿìè
[3] => 1:31:47
[4] => 672
)
[5] => Array
(
[0] => F27
[1] => àðñèàíèí
[2] => îé ëþáèìûé ìàðñèàíèí
[3] => 1:33:31
[4] => 597
)
[6] =>
)
Looks like it still loses foreign letters. Please REMOVE all foreign
letter checks from FGETCSV. Strange behavior sometimes results in
entire fields being lost.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/12127--
Edit this bug report at http://bugs.php.net/?id=12127&edit=1