|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-10 23:53 UTC] nlopess@php.net
[2006-06-11 00:17 UTC] stronk7 at moodle dot org
[2006-06-11 00:20 UTC] stronk7 at moodle dot org
[2006-06-11 00:40 UTC] stronk7 at moodle dot org
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 12:00:01 2025 UTC |
Description: ------------ I was using one simple preg_replace() to clean strings from control characters and, under XP I found that some utf-8 characters are also modified although they don't contain control characters (\x-\1f and \7f) at all. Same code seems to work properly under MacOS X and linux. Please note that code below is utf-8 and should be pasted with the editor in that mode. The char failing seems to be the upper i with dieresis: ? The example include the non-working example (first) plus two alternatives that work properly under XP. Ciao :-) Reproduce code: --------------- <?php $orig = "II????"; $dest = preg_replace("/[[:cntrl:]]/","",$orig); echo $dest; echo "\n<br>\n"; $orig = "II????"; $dest = ereg_replace("[[:cntrl:]]","",$orig); echo $dest; echo "\n<br>\n"; $orig = "II????"; $dest = preg_replace("/[\x-\x1f]/","",$orig); echo $dest; echo "\n<br>\n"; ?> Expected result: ---------------- Should return II???? in the three alternatives. Actual result: -------------- This returns: II???? <--- incorrect <br> II???? <--- correct <br> II???? <--- correct <br>