Created
October 2, 2013 13:35
-
-
Save jgdoncel/6793877 to your computer and use it in GitHub Desktop.
Eliminar caracteres no UTF8 de una cadena
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Supposing your want to be sure that $string is composed by valid UTF-8 characters: | |
$string = iconv("UTF-8","UTF-8//IGNORE",$string); | |
// If you want to remove none ISO-8859-1 characters from this string: | |
$string = iconv("UTF-8","ISO-8859-1//IGNORE",$string); | |
$string = iconv("ISO-8859-1","UTF-8",$string); | |
// If you still have characters you want to be ignored, try this: | |
$string = recode_string("us..flat", $string); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment