Skip to content

Instantly share code, notes, and snippets.

@MikeNGarrett
Created November 16, 2012 21:04
Show Gist options
  • Save MikeNGarrett/4090894 to your computer and use it in GitHub Desktop.
Save MikeNGarrett/4090894 to your computer and use it in GitHub Desktop.
Strip unknown/non-utf-8 characters
$new_text = preg_replace('/[^(\x20-\x7F)]*/','', $text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment