• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 812
  • Last Modified:

Coldfusion server not displaying accents correctly

I have a .cfm page/form with french words that have accents.  When displayed in any browser the accents don't display correctly.  If I change the extension from .cfm to .html and serve the page from the same directory the accents appear just fine (but the form is worthless).  It seems like there needs to be some configuration on the server side but I haven't found what that might be.  Is there config that needs to be done on the server side to get coldfusion to display accents correctly and what would it be?

Everything I've been able to find is that you need to use utf encoding in the page which I am but doesn't seem to matter to coldfusion
Code snippet:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Session 2</title></head>
 
<body>
<!---the "action" attribute has the form submit the information to this page (or itself), where the <cfif isdefined("form.submit")> tag takes over, processing the form data--->
<cfform id="form1" name="form1" method="post" action="session_2.cfm">
  <p align="center"><strong>Session 2</strong></p>
  <p>Prénom
    <label>
    <!--- below is where the validation takes place, there is the required directive and then the message to display if a selection has not been made.  This needs to be coded for every field in the form--->
    <cfinput type="text" name="prenom" id="prenom"
     required = "Yes"
      message = "Please enter a prénom"  />
    </label>
  Nom
  <label>
  <cfinput type="text" name="nom" id="nom" 
   required = "Yes"
      message = "Please enter a nom"  />
  </label>
  Numéro de 4 chiffres  </p>
  <p><strong>A  Composition</strong></p>
  <p>Votre meilleur(e) ami(e) vient de vous envoyer ce courriel:</p>
  <p>I decided to leave for China tomorrow morning! I'm not taking anything with me, I don't have any money, I don't speak Chinese and it's the first time I'm going on a trip. I know it sounds crazy but I cannot stand my parents anymore, especially my mother. She drives me crazy and I hate my step-father! So, I'm leaving morning and I don't know when I'll come back. Adieu!</p>
  <p>Empêchez votre ami(e) de commettre cette énorme erreur. Conseillez-le/la en lui écrivant une lettre (en anglais bien sûr) avec un minimum de 15 verbes ou expressions verbales différents. Cliquez dans l'espace ci-dessous pour commencer à écrire.</p>
  <p>
    <label>
    <cftextarea name="composition" id="composition" cols="80" rows="25" required="yes" message="Please enter a composition"></cftextarea>
    </label>
  </p>
  <p>&nbsp;</p>
  <p><strong>B  Complétez les phrases </strong></p>
  <p>Complétez les phrases suivantes en choisissant la forme correcte du verbe pour que la phrase soit logique et grammaticale. </p>
</body>
</html

Open in new window

0
mwbry
Asked:
mwbry
1 Solution
 
azadisaryevCommented:
which cf version are you on?
which db? which version? if it is ms access - are you using Access with Unicode driver in your cf dsn setup?
are the accented characters that do not display properly coming from your db, or are they plain-text in the page?

cf versions after 5 all use utf-8 as default page encoding. but your tables and db driver also have to use utf-8 charset/collation.

if you are using Application.cfm, include the following code in it:
<cfscript>
SetEncoding("form","utf-8");
SetEncoding("url","utf-8");
</cfscript>
<cfcontent type="text/html; charset=utf-8">

(if you are using Application.cfc, include similar code in onRequestStart() method)

you may also need to include <cfprocessingdirective pageencoding="utf-8"> at the top of every page in your site...

but i would start with making sure your db and cf 'speak the same language' - use the same charset and encoding (utf-8)

Azadi
0
 
mwbryAuthor Commented:
I am using Coldfusion 7.  There is no database involved in this application.  The form data writes a .txt file back to the directory from which the .cfm form is served so it's not an issue of displaying or writing data from or to a database.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now