Bug #62562 [Ana->Csd]: preg_replace mangles UTF8 string - Windows only
| From: | cmb@php.net | Date: | Wed, 22 Jun 2016 14:01:46 +0000 |
| Subject: | Bug #62562 [Ana->Csd]: preg_replace mangles UTF8 string - Windows only | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201799@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62562&edit=1
ID: 62562
Updated by: cmb@php.net
Reported by: magog dot the dot ogre at gmail dot com
Summary: preg_replace mangles UTF8 string - Windows only
-Status: Analyzed
+Status: Closed
Type: Bug
Package: *Regular Expressions
Operating System: Windows x86
PHP Version: 5.3.14
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The mentioned "pcre-whitespace" patch has been merged long ago,
so I'm closing this ticket.
Previous Comments:
------------------------------------------------------------------------
[2015-02-20 23:32:05] cmbecker69 at gmx dot de
To simplify the issue, it is sufficient to consider the UTF-8
encoded string 'áá á'. This is equivalent to
"\xE1\x83\x9D\xE1\x83\xA0\xE1\x83\x9B".
The string contains the character \xA0. According to the PCRE
documentation[1]:
| However, if locale-specific matching is happening, \s and \w may
| also match characters with code points in the range 128-255.
That is exactly what's happening on Windows, where under several
character encodings (amongst them CP-1252) it is a non-breaking
space character (NBSP), and as such it is converted to \x20 by the
preg_replace(), thereby mangling the string.
While this behavior is well documented by the PCRE documentation,
it is not so clear in the PHP manual, where only \w and \W escape
sequences are expressly documented as potentially
locale-specific[2].
So it seems to me this issue is rather a documentation problem. I
have submitted a respective patch via PhD O.E.
("pcre-whitespace").
BTW: the comment above from beat dot spahni at hotmail dot com is
completely unrelated to this issue, and might be deleted.
[1] <http://www.pcre.org/current/doc/html/pcre2syntax.html#SEC4>
[2] <http://php.net/manual/en/regexp.reference.escape.php>
------------------------------------------------------------------------
[2013-08-13 09:05:00] beat dot spahni at hotmail dot com
Wahrscheinlich gibt es nicht bei MySQL. Siehe unten. Es funktioniert nicht.
Probably there is not with MySQL. See below. It does not function.
$dat1=">='20".date('y-m', $timestamp)."-01'"; //
2013-08-01
$dat2="<='20".date('y-m-t', $timestamp)."'"; //
2013-08-31
$sql = "SELECT * FROM $table where Datum ".$dat1." and Datum ".$dat2; // Es
klappt
nicht. Vielleicht gibt es nicht. Stimmt das? It does not work. Maybe there is not.
Is this right?
$sql .= " order by Datum asc";
------------------------------------------------------------------------
[2013-03-10 23:19:25] magog dot the dot ogre at gmail dot com
I concur this is probably a Windows environment issue. Feel free to mark it worksforme, withdrawn,
etc.
I will try to get some time to run my own compilation on my system and I will request it be reopened
if I still have problems.
------------------------------------------------------------------------
[2012-07-22 20:36:57] pajoye@php.net
It is set as analyzed, not resolved.
Can you try to compile PHP using the bundle PCRE instead of the system one please?
------------------------------------------------------------------------
[2012-07-22 20:28:38] magog dot the dot ogre at gmail dot com
Just curious: why was this marked as solved?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=62562
--
Edit this bug report at https://bugs.php.net/bug.php?id=62562&edit=1