0

I want to remove non printable characters and keep french accents like "é". I'm able to do this in PHP 5.5 but not on PHP 5.6.

On PHP 5.5 :

$original = preg_replace('/[\x00-\x1F\x80-\x9F]/u', '', $original);

This works perfectly. But since my upgrade to PHP 5.6, it returns a blank value !

On PHP 5.6, i use this partial fix :

$original = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $original);

Non printable characters are removed but accents are removed too. How can I keep them?

When the variable is saved to SQL, I would like to have "mangé", but it returns "mang" on PHP 5.6 so.

Thanks for help !

Niranjan N Raju
  • 12,047
  • 4
  • 22
  • 41

0 Answers0