Bug #72330 [Opn->Fbk]: str_getcsv() splits fields incorrectly if escape char flollowed by UTF chars

From: Date: Tue, 14 Jun 2016 13:21:22 +0000
Subject: Bug #72330 [Opn->Fbk]: str_getcsv() splits fields incorrectly if escape char flollowed by UTF chars
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201607@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72330&edit=1 ID: 72330 Updated by: cmb@php.net Reported by: cronfy at gmail dot com Summary: str_getcsv() splits fields incorrectly if escape char flollowed by UTF chars -Status: Open +Status: Feedback Type: Bug Package: Strings related Operating System: Linux Mint 17.1 Rebecca PHP Version: Irrelevant Block user comment: N Private report: N New Comment: I can't reproduce this behavior, see <https://3v4l.org/QZJSC>. Maybe it's locale dependend? Previous Comments: ------------------------------------------------------------------------ [2016-06-03 16:00:42] cronfy at gmail dot com Description: ------------ When escape character set for str_getcsv() is followed by some UTF characters, string is parsed incorrectly. I tested it on php 5.4, 5.5, 5.6 and 7.0 - behavior is the same. Test script: --------------- $utf_1 = chr(0xD1) . chr(0x81); // U+0440; $utf_2 = chr(0xD8) . chr(0x80); // U+0600 $string = '"first #' . $utf_1 . $utf_2 . '";"second one"'; $d = str_getcsv($string, ';', '"', "#"); print_r($d); Expected result: ---------------- Array ( [0] => first #с؀ [1] => second one ) Actual result: -------------- Array ( [0] => first #с؀";second one" ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72330&edit=1

« previous php.bugs (#201607) next »