'mb_convert_encoding() not working on accented letters
I want to convert an array with accented characteres from ISO 8859-1 to UTF-8, but when i try to convert the uppercase letters, it dont work, whats should i do?
The loop works with the lowercase letters, when it reachs the uppercase ones it bugs out, there's something missing here?
The problem its that my database have some especial characteres on it and i want to replace them with utf-8 characteresç
My code:
$normal = array(
'á',
'â',
'à',
'å',
'ä',
'ð',
'é',
'ê',
'è',
'ë',
'í',
'î',
'ì',
'ï',
'ó',
'ô',
'ò',
'ø',
'õ',
'ö',
'ú',
'û',
'ù',
'ü',
'ç',
'Á',
'Â',
'À',
'Å',
'Ä',
'Ð',
'É',
'Ê',
'È',
'Ë',
'Í',
'Î',
'Ì',
'Ï',
'Ó',
'Ô',
'Ò',
'Ø',
'Õ',
'Ö',
'Ú',
'Û',
'Ù',
'Ü',
'Ç'
);
for ($i=0; $i < count($normal); $i++) {
$especial = mb_convert_encoding($normal[$i], 'UTF-8', 'ISO-8859-1');
echo $especial . PHP_EOL;
}
output:
á
â
Ã
Ã¥
ä
ð
é
ê
è
ë
Ã
î
ì
ï
ó
ô
ò
ø
õ
ö
ú
û
ù
ü
ç
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Ã
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
