Remove non-utf8 characters from string

User login

Here is a nice little PHP snippet that will remove non-ASCII characters from a String.


<?php
$string
= "Remove these characters: รครณ";
$string = preg_replace('/[^(\x20-\x7F)]*/','', $string);
?>

Code was taken from here.

Tags: 
PHP / MySQL