Answer the question
In order to leave comments, you need to log in
Zend_Filter_StringTrim not working correctly with UTF-8?
It turned out that the filter for string trimming, although it declares a "Unicode aware trim method", is not that "aware trim" after all. If it gets a string ending in the Cyrillic capital "R", it gets corrupted. Probably because its UTF-8 representation ends in A0.
Specifically, the problem comes up in this regular expression: preg_replace('/^[\s]*|[\s]*$/sSD', '', $value)
If you add the u modifier, the result is generally NULL.
Nobody faced such a problem?
Answer the question
In order to leave comments, you need to log in
PHP 5.2.10, 5.3.3 - Adding the u flag solves the problem. Regarding its absence, it makes sense to write a bug report .
By the way, the normal native PHP trim() function, when used without a second argument (or if there are no non-ASCII characters in it), is quite safe for UTF-8 strings.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question