Bug #69840 [Opn->Ver]: iconv_substr() doesn't work with UTF-16BE

From: Date: Mon, 15 Jun 2015 21:44:43 +0000
Subject: Bug #69840 [Opn->Ver]: iconv_substr() doesn't work with UTF-16BE
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193526@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69840&edit=1

 ID:                 69840
 Updated by:         cmb@php.net
 Reported by:        jan dot slabon at setasign dot com
 Summary:            iconv_substr() doesn't work with UTF-16BE
-Status:             Open
+Status:             Verified
 Type:               Bug
 Package:            ICONV related
 Operating System:   Windows 7 Pro
 PHP Version:        7.0.0alpha1
 Block user comment: N
 Private report:     N

 New Comment:

Confirmed: <http://3v4l.org/C9im4>.


Previous Comments:
------------------------------------------------------------------------
[2015-06-15 16:03:28] jan dot slabon at setasign dot com

Description:
------------
The iconv_substr() function returns false instead of the expected substring.

I just tried UTF-16LE which works:

php -r "var_dump(iconv_substr(\"a\x00b\x00\", 0, 1, 'UTF-16LE'));"
string(2) "a\x00"

Also iconv_strlen() works as expected.

Test script:
---------------
var_dump(iconv_substr("\x00a\x00b", 0, 1, 'UTF-16BE'));

Expected result:
----------------
string(2) "\x00a"

Actual result:
--------------
bool(false)


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69840&edit=1


Thread (5 messages)

« previous php.bugs (#193526) next »