bsh34 Posté(e) le 13 janvier 2006 Partager Posté(e) le 13 janvier 2006 Voila, j'ai besoin de convertir des majuscules en minuscules et caractères spéciaux en rien "" qui sont rentrer dans un formulaire. Pour ça, j'utilise une fonction faites maison pour tout convertir. Avant j'utilisais strtolower pour les majuscules mais finalement j'ai tout regrouper la dedans, voila tout le début du code avec l'ancien strlolower en commentaire ( au cas où ) <? $name=$_POST["nom"]; $mdp=$_POST["password"]; $opt=$_POST["option"]; #$name= strtolower($name); #$mdp= strtolower($mdp); #$opt= strtolower($opt); function suppaccents($name) { $accents = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y", "Z","À","Á","Â","Ã","Ä","Å","à","á","â","ã","ä","å","Ò","Ó","Ô","Õ","Ö","Ø","ò","ó","ô","õ","ö","ø","È","É","Ê","Ë","è", "é","ê","ë","Ç","ç","Ì","Í","Î","Ï","ì","í","î","ï","Ù","Ú","Û","Ü","ù","ú","û","ü","ÿ","Ñ","ñ",":",",",".",";","?","!","~","'","´" ,"(",")","/","&","%","*","\\","\"","$","[","]","{","}","|"); # passage à la ligne rajouter sur le forum pour pas mettre toute la mise en page du site en l'air $ssaccents = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","a","a","a","a", "a","a","a","a","a","a","a","a","o","o","o","o","o","o","o","o","o","o","o","o","e","e","e","e","e","e","e","e","c","c","i", "i","i","i","i","i","i","i","u","u","u","u","u","u","u","u","y","n","n","","","","","","","","","","","","","","","","","","","","","", "","" ); # passage à la ligne rajouter sur le forum pour pas mettre toute la mise en page du site en l'air $name = str_replace($accents,$ssaccents,$name); return($name); } $name = suppaccents($name); echo $name $enreg=fopen(". ... etc ?> Le problème est que les caractères éèêëà etc sont affcher a�leve sous firefox et a?la?ves sous ie (en plus que mon code HTML ne soient plus compatibles IE, mais c'est une autre histroire CSS) Alors voila, je ne comprends pas pourquoi les caractères majuscules sont bien converti, les spéciaux aussi mais pas les accents (alors que c'est le but premier, les majuscules je peux utiliser strlolower pour le faire ) Et si qq'un a mieux en plus court et qui marche surtout, je suis preneur Merci d'avance Lien vers le commentaire Partager sur d’autres sites More sharing options...
RaphAstronome Posté(e) le 13 janvier 2006 Partager Posté(e) le 13 janvier 2006 Topic en double Déja tu as plein d'entrées qui font comme un strtolower() tu peut les enlever. Lien vers le commentaire Partager sur d’autres sites More sharing options...
SyGEN Posté(e) le 13 janvier 2006 Partager Posté(e) le 13 janvier 2006 heuu bêtement : function suppaccents($text){ $text= strtr($text, "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ", "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn"); return $text; } Lien vers le commentaire Partager sur d’autres sites More sharing options...
CoxleDingo Posté(e) le 14 janvier 2006 Partager Posté(e) le 14 janvier 2006 on continue sur l'autre alors... Lien vers le commentaire Partager sur d’autres sites More sharing options...
Messages recommandés
Archivé
Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.