Muchas gracias
gakutaru.
Lo intenté pero por ese camino me convertía los apóstrofes en una cosa rara... algo como el signo del Euro con un TM
Buscando encontré esta función:
Código PHP:
function all_ascii( $stringIn ){
$final = '';
$search = array(chr(145),chr(146),chr(147),chr(148),chr(150),chr(151));
$replace = array("'","'",'"','"','-','-');
$hold = str_replace($search[0],$replace[0],$stringIn);
$hold = str_replace($search[1],$replace[1],$hold);
$hold = str_replace($search[2],$replace[2],$hold);
$hold = str_replace($search[3],$replace[3],$hold);
$hold = str_replace($search[4],$replace[4],$hold);
$hold = str_replace($search[5],$replace[5],$hold);
if(!function_exists('str_split')){
function str_split($string,$split_length=1){
$count = strlen($string);
if($split_length < 1){
return false;
} elseif($split_length > $count){
return array($string);
} else {
$num = (int)ceil($count/$split_length);
$ret = array();
for($i=0;$i<$num;$i++){
$ret[] = substr($string,$i*$split_length,$split_length);
}
return $ret;
}
}
}
$holdarr = str_split($hold);
foreach ($holdarr as $val) {
if (ord($val) < 128) $final .= $val;
}
return $final;
}
Y se aproxima mucho a la solución pero me remueve los apóstrofes y no entiendo por qué (remueve los apóstrofes invertidos char(145) y char(146), los otros nop).
Alguien puede explicarme ?