Bug #76158 [Nab]: UTF-8 character C29D handling
| From: | miloslav dot hula at gmail dot com | Date: | Wed, 28 Mar 2018 12:23:53 +0000 |
| Subject: | Bug #76158 [Nab]: UTF-8 character C29D handling | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214507@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76158&edit=1
ID: 76158
User updated by: miloslav dot hula at gmail dot com
Reported by: miloslav dot hula at gmail dot com
Summary: UTF-8 character C29D handling
Status: Not a bug
Type: Bug
Package: *General Issues
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Sorry, I'm idiot.
Previous Comments:
------------------------------------------------------------------------
[2018-03-28 12:16:33] requinix@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
http://php.net/manual/en/function.sprintf.php
> X - the argument is treated as an integer and presented as a hexadecimal number (with uppercase
> letters).
Use ord($c).
------------------------------------------------------------------------
[2018-03-28 12:13:40] miloslav dot hula at gmail dot com
Description:
------------
I expected that I can split any string to single octects, but it does not work for UTF-8 character
C29D
https://3v4l.org/FjUb7
Test script:
---------------
<?php
$ch = "\xc2\x9d";
foreach (str_split($ch) as $c) {
echo sprintf("0x%02X", $c) . "\n";
}
Expected result:
----------------
0xC2
0x9D
Actual result:
--------------
0x00
0x00
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76158&edit=1