Some time ago I developed this solution for my PHP environment,
function changeLetters($string, $down = true){
$letters = array(
'A'=>array('@','â','ä','à','å','Ä','Å','á','ª','Á','Â','À','ã','Ã'),
'E'=>array('&','é','ê','ë','è','É','£','Ê','Ë','È'),
'I'=>array('!','ï','î','ì','¡','Í','Î','Ï','Ì','í'),
'O'=>array('ô','ö','ò','Ö','ø','Ø','ó','º','¤','ð','Ó','Ô','Ò','õ','Õ'),
'U'=>array('ü','û','ù','Ü','ú','µ','Ú','Û','Ù'),
'B'=>array('ß'),
'C'=>array('Ç','ç','©','¢'),
'D'=>array('Ð'),
'F'=>array('ƒ'),
'L'=>array('¦'),
'N'=>array('ñ','Ñ'),
'S'=>array('$','§'),
'X'=>array('×'),
'Y'=>array('ÿ','¥','ý','Ý'),
'AE'=>array('æ','Æ'),
'P'=>array('þ','Þ'),
'R'=>array('®'),
'0'=>array('°'),
'1'=>array('¹','ı'),
'2'=>array('²'),
'3'=>array('³'),
);
foreach ($letters as $letter => $change){
if($down){ $letter = down($letter); }
$string = str_replace($change, $letter, $string);
}
return $string;
}
I know your question is based on language r
, but posted more as help for possible variant of letters.
Lucas, your two examples worked on my computer. You could put the result of
Sys.getlocale()
of your machine?– Carlos Cinelli
There’s even a question in Stackoverflow that uses the same function.http://stackoverflow.com/questions/20495598/replace-accented-characters-in-r-with-non-accented-counterpart-utf-8-encoding.
– Arthur Alvim
It was for the
iconv()
have worked– Rcoster