Bonjour,
existe-t-il un moyen d'encoder un texte avec plein d'accents en norme ISO-8859-1 ? un utilitaire PHP ? un site internet ?
parce que je me vois très mal recoder tous les caractères spéciaux en ISO-8859-1...
merci d'avance
<form action="trad.php" method="post">
<p>
<label for="texte">texte à traduire :<br></label>
<textarea name="texte" rows="20" cols="60"></textarea>
</p>
<p>
<input type="reset" name="reset" value="Effacer" />
<input type="submit" name="send" value="Envoyer" />
</p>
</form>
<?php
$texte=$_POST['texte'];
$texte = preg_replace('#\<b\>(.+)\</b\>#i', '<strong>$1</strong>', $texte);
$texte = preg_replace('#\à#', 'à', $texte);
$texte = preg_replace('#\ç#', 'ç', $texte);
$texte = preg_replace('#\è#', 'è;', $texte);
$texte = preg_replace('#\é#', 'é', $texte);
$texte = preg_replace('#\ê#', 'ê', $texte);
$texte = preg_replace('#\ô#', 'ô', $texte);
$texte = preg_replace('#\ù#', 'ù', $texte);
$texte = preg_replace('#\!#', '!', $texte);
$texte = preg_replace('#\"#', '"', $texte);
$texte = preg_replace('#\'#', ''', $texte);
$texte = preg_replace('#\<#', '<', $texte);
echo "Texte à traduire :<br><br>";
echo $texte;
/*echo "Texte traduit : <br><br>";
echo '<textarea name="texte" rows="20" cols="60">';echo $texte; echo'</textarea>';*/
?>
<br>
<a href="index.html">Traduire un autre texte</a>
abcdef éè;ùà!
abcdef éè;ùà!
<!--by www.cyrilguerin.fr-->
<form action="trad.php" method="post">
<p>
<table>
<tr><td><label for="choix">Coder en : </label></td>
<td>ISO<INPUT type=radio name="choix" value="iso" checked="checked">
<br>HTML<INPUT type=radio name="choix" value="html">
<br>Les deux<INPUT type=radio name="choix" value="lesdeux"></td></tr>
</table>
</p>
<p>
<label for="texte">texte à coder :<br></label>
<textarea name="texte" rows="20" cols="60"></textarea>
</p>
<p>
<input type="reset" name="reset" value="Effacer" />
<input type="submit" name="send" value="Envoyer" />
</p>
</form>
<?php
/*by www.cyrilguerin.fr*/
$choix=$_POST['choix'];
$texte=$_POST['texte'];
function writeTextFile($fileName,$text) {
$session = fopen($fileName,"a+");
fputs($session,$text);
fclose($session);
}
if ($choix == 'iso'){
$texte = preg_replace('#\à#', 'à', $texte);
$texte = preg_replace('#\ç#', 'ç', $texte);
$texte = preg_replace('#\è#', 'è', $texte);
$texte = preg_replace('#\é#', 'é', $texte);
$texte = preg_replace('#\ê#', 'ê', $texte);
$texte = preg_replace('#\ô#', 'ô', $texte);
$texte = preg_replace('#\ù#', 'ù', $texte);
$texte = preg_replace('#\!#', '!', $texte);
$texte = preg_replace('#\"#', '"', $texte);
$texte = preg_replace('#\'#', ''', $texte);
$texte = preg_replace('#\<#', '<', $texte);
$texte = preg_replace('#\@#', '@', $texte);
$texte = preg_replace('#\€#', '€', $texte);
$texte = preg_replace('#\©#', '©', $texte);
echo "<u>Texte de base :</u><br><br>";
echo $texte;
echo "<br><br>";
ob_start();
$content = ob_get_contents();
writeTextFile("texteiso.php",$texte);
echo "<u>Texte codé en ISO :</u><br><br>";
highlight_file('texteiso.php');
}
else if($choix == 'html'){
$texte = preg_replace('#\<b\>(.+)\</b\>#i', '<strong>$1</strong>', $texte);
$texte = preg_replace('#\à#', 'à', $texte);
$texte = preg_replace('#\ç#', 'ç', $texte);
$texte = preg_replace('#\è#', 'è', $texte);
$texte = preg_replace('#\é#', 'é', $texte);
$texte = preg_replace('#\ê#', 'ê', $texte);
$texte = preg_replace('#\ô#', 'ô', $texte);
$texte = preg_replace('#\ù#', 'ù', $texte);
$texte = preg_replace('#\"#', '"', $texte);
$texte = preg_replace('#\<#', '<', $texte);
$texte = preg_replace('#\€#', '€', $texte);
$texte = preg_replace('#\©#', '©', $texte);
echo "<u>Texte de base :</u><br><br>";
echo $texte;
echo "<br><br>";
ob_start();
$content = ob_get_contents();
writeTextFile("textehtml.php",$texte);
echo "<u>Texte codé en HTML : </u><br><br>";
highlight_file('textehtml.php');
}
else if($choix == 'lesdeux'){
$textehtml = $texte;
$texteiso = $texte;
$textehtml = preg_replace('#\<b\>(.+)\</b\>#i', '<strong>$1</strong>', $textehtml);
$textehtml = preg_replace('#\à#', 'à', $textehtml);
$textehtml = preg_replace('#\ç#', 'ç', $textehtml);
$textehtml = preg_replace('#\è#', 'è', $textehtml);
$textehtml = preg_replace('#\é#', 'é', $textehtml);
$textehtml = preg_replace('#\ê#', 'ê', $textehtml);
$textehtml = preg_replace('#\ô#', 'ô', $textehtml);
$textehtml = preg_replace('#\ù#', 'ù', $textehtml);
$textehtml = preg_replace('#\"#', '"', $textehtml);
$textehtml = preg_replace('#\<#', '<', $textehtml);
$textehtml = preg_replace('#\€#', '€', $textehtml);
$textehtml = preg_replace('#\©#', '©', $textehtml);
echo "<u>Texte de base :</u><br><br>";
echo $textehtml;
echo "<br><br>";
ob_start();
$content = ob_get_contents();
writeTextFile("textehtml.php",$textehtml);
echo "<u>Texte codé en HTML</u> : <br><br>";
highlight_file('textehtml.php');
$texteiso = preg_replace('#\à#', 'à', $texteiso);
$texteiso = preg_replace('#\ç#', 'ç', $texteiso);
$texteiso = preg_replace('#\è#', 'è', $texteiso);
$texteiso = preg_replace('#\é#', 'é', $texteiso);
$texteiso = preg_replace('#\ê#', 'ê', $texteiso);
$texteiso = preg_replace('#\ô#', 'ô', $texteiso);
$texteiso = preg_replace('#\ù#', 'ù', $texteiso);
$texteiso = preg_replace('#\!#', '!', $texteiso);
$texteiso = preg_replace('#\"#', '"', $texteiso);
$texteiso = preg_replace('#\'#', ''', $texteiso);
$texteiso = preg_replace('#\<#', '<', $texteiso);
$texteiso = preg_replace('#\@#', '@', $texteiso);
$texteiso = preg_replace('#\€#', '€', $texteiso);
$texteiso = preg_replace('#\©#', '©', $texteiso);
echo "<br><br>";
ob_start();
$content = ob_get_contents();
writeTextFile("texteiso.php",$texteiso);
echo "<u>Texte codé en ISO :</u><br><br>";
highlight_file('texteiso.php');
}
?>
<br>
<a href="index.php"><br>Traduire un autre texte</a>
<?php if (file_exists("texteiso.php")){unlink("texteiso.php");}
if (file_exists("textehtml.php")){unlink("textehtml.php");}?>
Vous n'aimez pas le lifting de Facebook ? Le site Mashable propose cinq étapes pour revenir à l'ancienne présentation du réseau social.
Par contre va falloir que t'aprennes un peu le code, tout du moins les bases avant de te lancer dans les REGEX ... Tout est inscrit la dedans , suffit de tirer les informations a ton profit ;)