Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1278 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  Problème : aucun accent dans mon formulaire

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Problème : aucun accent dans mon formulaire

n°2009861
Lap1n0u
My mother had me tested.
Posté le 19-07-2010 à 02:06:52  profilanswer
 

Salut à tous,

 

J'ai terminé aujourd'hui mon premier site en flash, dans lequel est intégré un formulaire de contact. Tout marche super bien, à l'exception des caractères accentués dans les champs "Nom", "Email", "Message" etc... En effet, beaucoup de caractères peuvent être écris dont •, ^, `, mais les caractères du style à é è ê ç ne marche définitivement pas.
J'ai bien vérifié que toutes mes pages de configuration xml et mon fichier contact.php soient encodés en UTF-8, et les xml appellent l'utf-8 par <?xml version="1.0" encoding="utf-8"?>.

 

J'ai essayé (un peu à tâton, je ne m'y connais pas vraiment) d'inclure des fonctions du style $message = utf8_decode($message); ou $message = str_replace("&#224;","à",$message); mais rien n'y fait.
A la base, c'est le swf qui apelle les fichiers de configuration xml du formulaire, donc peut-être que je ne cherche pas au bon endroit, mais j'ai bien vérifié dans le .swf décompilé, et je ne vois nulle part où pourrait être l'erreur. J'ai déjà cherché pendant 1h et demie sur internet, je ne trouve rien.

 

Ci-joint le code des fichiers "contact.php", "form04Configuration.xml" et "form04Structure.xml" nécessaires au formulaire. Merci de votre aide, je galère là  :ange:

 

EDIT : Je rectifie un poil, seul le caractère "é" marche correctement, les autres ne fonctionnent tout simplement pas (quand je les tape, rien ne s'affiche, mais je peux continuer à rédiger mon message avec un "trou" à l'endroit où était supposé être le caractères accentué).

 
Citation :

<?php
//-----------------Getting data sent by flash---------------------
foreach ($_POST as $key => $value){

 

 if ($key != 'mail_to' && $key != 'smtp_server' && $key != 'smtp_port' && $key != 'mail_from' && $key != 'mail_subject' && $key != 'plain_text'){
 
   $mail_body .= '<b>'.str_replace('_',' ',$key).'</b>:<br/>';
 
   $mail_body .= ''.stripslashes($value).'<br/>';
  }
}
//-----------------------------------------------------------------

  

$message = '<html><body>'.$mail_body.'</body></html>'; //  mail body

 

//------------if plain text is set to true removing html tags------
if ($_POST['plain_text']=='true') {

 

$message = str_replace('<br/>',"\r\n", $message);

 

$message = strip_tags($message);

 

//------------------------------------------------------------------
} else {
//----otherwise composing message headers---------------------------
 $headers  = 'MIME-Version: 1.0' . "\r\n";
 
 $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
//------------------------------------------------------------------
}

 

//------------setting conf data-------------------------------------
$to = $_POST['mail_to'];

 

$from = $_POST['mail_from'];

 

$subject = $_POST['mail_subject'];

 

$smtp_server = $_POST['smtp_server'];

 

$smtp_port = $_POST['smtp_port'];
//------------------------------------------------------------------

 

//---------setting header info--------------------------------------
$headers .= 'To: '.$to. "\r\n";

 

$headers .= 'From: Site visitor ' .$from. "\r\n";
//------------------------------------------------------------------

 


if (mail("MONADRESSEMAIL", $subject, $message, $headers)){ // sending mail

 

print('&mail=1');  //succes

 

} else {

 

print('&mail=0');//failure

 

}

 

?>


Citation :

<?xml version="1.0" encoding="utf-8"?>

 

<!--
  -- Please read this information to learn how to set up the contact form integrated
  -- into the template.
  --
  -- This readme file explains in details the meaning of the settings that can be
  -- done in the fcContactFormConfiguration.xml configuration file.
  --
  -- It is recommended for you to use an XML editor to make changes to this file
  --  because it’s less possible to make an error in the markup which can cause to
  -- a not working contact form.
  -->
<contactFormConfiguration>
     
 <!--
   -- An e-mail address which will be used to receive messages from your contact form.
   -- You can specify several e-mail addresses separating them with a comma.
   -- For example: first_email@domain.com, second_email@domain.com, third@domain.com
   -->
 <emailTo>MONADRESSEMAIL</emailTo>
 
 <!--
   -- A server script type which will process sending e-mails. It depends on your
   -- hosting and in the current version of the contact form it is allowed to use
   -- two types:  php (Apache, PHP Hosting); asp (IIS web server, ASP).
   -->
 <serverProcessorType>php</serverProcessorType>
 
 <!--
   -- A name of the script file which process sending e-mails on your server (without
   -- extension). The name contact is used by default.
   -->
 <serverProcessorFileName>contact</serverProcessorFileName>
 
 <!--
   -- Set whether to validate only required fields (true/false).  The default value is
   -- true which means the not required fields of your contact form will not be validated.
   -- For example if the e-mail field of your form is set as not required (imagine it)
   -- the form will be processed even if the user types in an incorrect e-mail address.
   -->
 <validateRequiredOnly>false</validateRequiredOnly>
 
 <!--
   -- Set whether to submit the form when the Enter key is pressed even if the focus is
   -- not on the Submit button (true/false).
   -->
 <submitFormOnEnter>false</submitFormOnEnter>
 
 <!--
   -- Text showing to the user when the form is submitted without any errors.
   -->
 <messageSentText>Votre message a bien été envoyé.</messageSentText>
 
 <!--
   -- Text showing in case the form is not submitted because of a server error.
   -->
 <messageSentFailedText>Votre message n'a pas pu être envoyé.</messageSentFailedText>
 
 <!--
   -- Text your visitor will see while waiting till the processing is over.
   -->
 <formProcessingText>Envoi...</formProcessingText>
 
 <!--
   -- Your SMTP server (for ASP only).
   -->
 <smtpServer>localhost</smtpServer>
 
 <!--
   -- Your SMTP port (for ASP only).
   -->
 <smtpPort>25</smtpPort>
 
 <!--
   -- Set whether to send the message as a plain text (true) or as HTML (false).
   -->
 <plainText>false</plainText>
 
 <!--
   -- ID of the input field (in the structure XML file) to use for the “from: ”
   -- or email to use instead (for example: mailfrom@domainname.com).
   -->
 <emailFromSource>3</emailFromSource>
 
 <!--
   -- Subject of the e-mails that will be sent through this contact form or ID of
   -- the input field (in the structure XML file) to use for the “subject: ” label
   -- in your e-mail client.
   -->
 <subjectSource>Message de votre site</subjectSource>
 
 <!--
   -- Validation error messages that are showing to the user when the form fails to
   -- validate. The form supports different types of validators. You can change the
   -- text of the error messages the validators produce here.
   --
   -- You can use the {LABEL} keyword in these messages. It will replace it with the
   -- label value of the field where an error occurs.
   -->
 <validationErrorMessages>
     
  <!--
    -- A required field is not filled in.
    -->
  <message type="fieldIsRequired">{LABEL} est requis.</message>
 
  <!--
    -- The specified e-mail address is incorrect.
    -->
  <message type="emailNotValid">{LABEL} - n'est pas une adresse valide.</message>
 
  <!--
    -- The specified number of characters in a field is less than a required minimum.
    -->
  <message type="minCharsLimitError">{LABEL} - Le nombre de caractères minimum dans une case n'est pas atteint.</message>
 
  <!--
    -- The specified string does not match with the regular expression.
    -->
  <message type="reqExpError">{LABEL} - The specified string does not match with the regular expression.</message>
 
  <!--
    -- The specified number is greater than an acceptable biggest number for this field.
    -->
  <message type="biggerThanMaxError">{LABEL} - The specified number is greater than an acceptable biggest number for this field.</message>
 
  <!--
    -- The specified number is lower than an acceptable lowest number for this field.
    -->
  <message type="lowerThanMinError">{LABEL} - The specified number is lower than an acceptable lowest number for this field.</message>
 
  <!--
    -- The data is not a number.
    -->
  <message type="notANumberError">{LABEL} - Ceci n'est pas un nombre.</message>
 
  <!--
    -- The specified number must not be negative.
    -->
  <message type="negativeError">{LABEL} - Le nombre spécifié ne doit pas être négatif.</message>
 
  <!--
    -- The minimum number of variants is not selected
    -->
  <message type="minRequirementError">{LABEL} - The minimum number of variants is not selected</message>
 
  <!--
    -- The number of variants selected exceeds the maximum
    -->
  <message type="maxRequirementError">{LABEL} - The number of variants selected exceeds the maximum</message>
 
  <!--
    -- The fields that should be equal do not match
    -->
  <message type="shouldBeEqualError">{LABEL} - values do not match</message>

 

 <!--
    --  The date has wrong format.
    -->
  <message type="dateIsNotValidError">{LABEL} - date has wrong format</message>

 

</validationErrorMessages>
 
</contactFormConfiguration>

 
Citation :

<?xml version="1.0" encoding="utf-8"?>

 

<contactFormStructure>
 
 <formItems>

 

 <item id="1" label="Nom" required="true">
   <textToShow>Votre Nom*:</textToShow>
  </item>

 

 <item id="2" label="Telephone">
   <textToShow>Téléphone:</textToShow>                    
                        <restrict>+-.0-9</restrict>
  </item>

 

 <item id="3" label="E-mail" required="true">
   <textToShow>Adresse email*:</textToShow>
   <validator>EmailValidator</validator>
  </item>

 

 <item id="4" label="Message" required="true">
   <textToShow>Votre message*:</textToShow>
  </item>

 

</formItems>
 
</contactFormStructure>


Message édité par Lap1n0u le 19-07-2010 à 02:21:01

---------------
[VDS] Rien pour le moment
mood
Publicité
Posté le 19-07-2010 à 02:06:52  profilanswer
 

n°2009954
Pascal le ​nain
Posté le 19-07-2010 à 12:12:34  profilanswer
 

Ca ressemble au problème que j'ai actuellement :
 
http://forum.hardware.fr/hfr/Progr [...] 9978_1.htm
 
Si tu peux me confirmer ça...

n°2009957
Lap1n0u
My mother had me tested.
Posté le 19-07-2010 à 12:19:43  profilanswer
 

C'est effectivement un peu la même chose :) en fait quand on tape les caractères (polonais pour toi, lettres accentués hormis le "é" pour moi) rien ne s'affiche, c'est comme si les caractères n'existaient pas et ne pouvaient donc pas être tapés...
 
Je n'ai toujours pas réussi à résoudre le problème, j'ai cherché comme un fou ce matin, rien de rien :o
 
NEED HELP, NEED HELP :D


---------------
[VDS] Rien pour le moment
n°2009959
Pascal le ​nain
Posté le 19-07-2010 à 12:23:51  profilanswer
 

Tu as regardé ce qu'a proposé abais ?
 
Faut que je teste cet aprèm


Message édité par Pascal le nain le 19-07-2010 à 12:23:56
n°2009971
Lap1n0u
My mother had me tested.
Posté le 19-07-2010 à 13:15:12  profilanswer
 

Ouiiiii ! J'ai testé et effectivement ça fonctionne :D
En fait dans ton .fla tu sélectionnes la fenêtre de texte dynamique qui sert à l'affichage du texte, et dans Propriétés tu choisis d'abord une police qui inclus les caractères français ET des caractères polonais, je suppose qu'arial est assez complète de ce point de vue. Pour être bien sûr que tous les caractères seront utilisables, tu cliques sur "Embbed" juste en dessous et dans la liste tu cliques sur "All". Pour finir, histoire d'être absolument certain que ça marche, tu vas chercher les caractères qui ne s'affichent pas dans la table des caractères de windaube et tu les colles dans la zone "Also include these characters:".

 

Pour moi ça a marché nickel, j'espère que pour toi ça sera la même chose :)


Message édité par Lap1n0u le 19-07-2010 à 13:15:44

---------------
[VDS] Rien pour le moment

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  Problème : aucun accent dans mon formulaire

 

Sujets relatifs
Problème pour appelé une feuille & extraire des données sous excelProblème avec une requête mysql en PHP
Probléme de float [Access] Appliquer filtre à un sous formulaire situé dans un onglet
resolut: probleme sitemap.xmlVBA tcd | problème avec un filtre
[fixed]Problème avec Zend_Soap_ServerProblème d'array
Problème imbrication d'objet Jquery IEprobleme d'accent avec formulaire mail
Plus de sujets relatifs à : Problème : aucun accent dans mon formulaire


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR