Skip to content

Instantly share code, notes, and snippets.

@dator-zz
Created March 18, 2011 11:12
Show Gist options
  • Save dator-zz/875905 to your computer and use it in GitHub Desktop.
Save dator-zz/875905 to your computer and use it in GitHub Desktop.
<?php
$str = htmlentities($str, ENT_NOQUOTES, $charset);
$str = preg_replace('#\&([A-za-z])(?:acute|cedil|circ|grave|ring|tilde|uml)\;#', '\1', $str);
$str = preg_replace('#\&([A-za-z]{2})(?:lig)\;#', '\1', $str); // pour les ligatures e.g. '&oelig;'
$str = preg_replace('#\&[^;]+\;#', '', $str); // supprime les autres caractères
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment