If I run this code in windows, it produces 'I!t!rn!ti!n!liz!ti!n', but if I move it to my linux server, it no longer performs the replace.
print preg_replace('/[À-ÖØ-öø-ÿ]/', '!', 'Iñtërnâtiônàlizætiøn');
I've uploaded the doc as a binary, to be sure FTP wasn't the cause. 开发者_如何学PythonI can read it fine on the server (no corruption of the symbols). It seems to be related to the Linux implementation of preg_replace?
If you are trying to get rid of all non-ascii characters better provide a negated list of valid charaters, i.e. something like [^a-zA-Z0-9]
(might have to add some symbols if you want them, too) instead of [ä-ö߀AndMuchMoreStuff]
This is likely locale related. But you should have the /u
unicode modifier in the regex nevertheless. - And might the Windows version of libPCRE enables that per default?
精彩评论