Bug #75214 [NEW]: trim&rtrim function makes some Chinese characters messy
| From: | yzhsh89 at 126 dot com | Date: | Sat, 16 Sep 2017 01:39:31 +0000 |
| Subject: | Bug #75214 [NEW]: trim&rtrim function makes some Chinese characters messy | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-211182@lists.php.net to get a copy of this message | ||
From: yzhsh89 at 126 dot com
Operating system: ANY
PHP version: 5.6.31
Package: *Unicode Issues
Bug Type: Bug
Bug description:trim&rtrim function makes some Chinese characters messy
Description:
------------
Some Chinese characters may lead to messy codes through trim or rtrim,
such as the Chinese character "è¨", and other untested.
I am using the PHP5.6.30 version, Other versions have not been tested.
Test script:
---------------
$str = "ãæ±è¯è¨ã";
echo ltrim($str, 'ã')."<br/>"; //correct
echo rtrim($str, 'ã')."<br/>"; //messy
echo trim($str, 'ã')."<br/>"; //messy
Expected result:
----------------
æ±è¯è¨ã
ãæ±è¯è¨
æ±è¯è¨
Actual result:
--------------
æ±è¯è¨ã
ãæ±è¯ï¿½
æ±è¯ï¿½
--
Edit bug report at https://bugs.php.net/bug.php?id=75214&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75214&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75214&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75214&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75214&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75214&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75214&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75214&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75214&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75214&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75214&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75214&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75214&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75214&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75214&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75214&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75214&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75214&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75214&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75214&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75214&r=mysqlcfg