Ainsi, votre texte arabe, a été codé dans Windows 1256 et mal encodés Windows 1252.
Si votre fichier source est UTF-8 codé, la réponse est:
<?php
$string = "ãÍãÏ Úæäí ãÍãæÏ Úáí";
$string = iconv("UTF-8//TRANSLIT//IGNORE", "Windows-1252//TRANSLIT//IGNORE", $string);
# $string is now back to its 1256 encoding. Encode to UTF-8 for web page
$string = iconv("Windows-1256//TRANSLIT//IGNORE", "UTF-8//TRANSLIT//IGNORE", $string);
echo $string;
?>
Si votre fichier source est "Windows 1252" codé, vous devez utiliser:
<?php
$string = "ãÍãÏ Úæäí ãÍãæÏ Úáí";
# Interperate windows-1252 string as if it were windows-1256. Encode to UTF-8 for web page
$string = iconv("Windows-1256//TRANSLIT//IGNORE", "UTF-8//TRANSLIT//IGNORE", $string);
echo $string;
?>
Si En fait, vous venez d'une base de données ou d'un fichier, puis vous devez déterminer le codage de la source avant d'appliquer une conversion.
Quelle est la question? –
@Alastair McCormack Je veux que la chaîne soit montrée en arabe, qui est محمد عوني محمود علي –
Quel est le codage de votre fichier source? –