2
I have this script that separates a string by character.
<?php
$key = "VÔMITOS";
for( $i=0; $i < $n_caracteres ; $i++ ){
print $key[$i]."\n";
}
?>
And it returns the following error: V M I T O.
I’ve used the following codes
In HTML
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
In PHP
ini_set('default_charset','UTF-8');
header( 'Content-Type: text/html; charset=utf-8' );
Someone would have a solution.
@George
mb_split
should solve your problem. Please see the answers to this question: https://answall.com/q/111131/3635– Guilherme Nascimento
@Guilhermenascimento I just used no longer worked
– George
And are you sure you used it correctly? You tried
preg_split("//u", $str, -1, PREG_SPLIT_NO_EMPTY)
? See that it is more than one answer, all have explanation, so read them and do the tests calmly and carefully. Enjoy and check the important details to work with UTF-8 following the tips at: https://answall.com/a/43205/3635– Guilherme Nascimento
Besides all the stuff that people have been talking about up there, in case you didn’t want to do it their way. Have to see if you saved the document in UTF8 format as well and if the in Apache/PHP is configured the charset for UTF8 as well.
– cHida