Edit report at https://bugs.php.net/bug.php?id=65132&edit=1
ID: 65132 Updated by: ahar...@php.net Reported by: daniel at 203core dot se Summary: trim does not include non breaking whitespace -Status: Open +Status: Wont fix Type: Bug -Package: Scripting Engine problem +Package: Strings related Operating System: FreeBSD 9.1 PHP Version: 5.4.16 Block user comment: N Private report: N New Comment: There are multibyte encodings which are ASCII compatible where a0 is a valid byte in non-space characters, Shift JIS being the most obvious one. There would also be the issue that a0 is only part of the non-breaking space character in UTF-8 â to trim UTF-8 NBSPs, you'd have to also include c2, which would cause even more problems. As a result, we can't really change this. Closing won't fix. Previous Comments: ------------------------------------------------------------------------ [2013-06-26 08:19:50] daniel at 203core dot se Description: ------------ If a line contains a non-breaking white space (\xA0) trim doesnt strip it, it should as its a "space" character This can easily be bypassed by sending the \xA0 character in the option parameter but it took a while to figure out there was a non-breaking space character in the string Test script: --------------- <?php $string = " \xA0"; echo strlen(trim($string)); Expected result: ---------------- the script should output a length of 0 Actual result: -------------- The script outputs a length of 1 as trim doesnt strip the non breaking space ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65132&edit=1