Skip to main content
Dani Szwarc
Inspiring
March 12, 2009
Answered

French characters and CFXML

  • March 12, 2009
  • 1 reply
  • 726 views
Hello people, I'm having a problem and I'm not sure what I'm doing wrong.
I have created a CMS for a kindergarten in Montreal. They speak French.
In this CMS they can create new photo galleries and upload their photos.
In order to do this, I have a form that creates the gallery and write it into a mySQL database. Then, once all the images for this gallery have been uploaded, an XML file is created, which will feed a flash gallery.

The problem occurs when the name of the gallery they enter has special French characters. It is being written properly to the DB, but at the time the CFXML creates the XML code or at the time cffile writes the xml file itself, those characters get corrupted.

I'm attaching the code that queries the DB and creates the XML code and file.
Any hint will be appreciated.

Thanks a lot.
    This topic has been closed for replies.
    Correct answer Dani Szwarc
    Hello again...I found the answer: if someone is in the same situation, here it is: Check the added charset="utf-8" in the cffile:

    <cffile action="Write" charset="utf-8"
    file="#ExpandPath('test.xml')#" <!--- name of the file you want to create --->
    output="#ToString(myXMLObject)#">

    1 reply

    Dani Szwarc
    Dani SzwarcAuthorCorrect answer
    Inspiring
    March 12, 2009
    Hello again...I found the answer: if someone is in the same situation, here it is: Check the added charset="utf-8" in the cffile:

    <cffile action="Write" charset="utf-8"
    file="#ExpandPath('test.xml')#" <!--- name of the file you want to create --->
    output="#ToString(myXMLObject)#">
    Participant
    February 1, 2012

    Hi Dani,

    I was also facing one issue with forming an xml using cfxml tag. There is a sybmol yen ¥ (start of a LIN tag in below example) which is there in the xml and when i try to dump the xml variable it shows one more character Latin capital letter A (Â) automaticall added in the variable and my request to the webservice fails due to the same reason.

    <cfxml variable="request1">

            <?xml version="1.0" encoding="ISO-8859-1"?>       

            <peticion>

                <nombre>Request</nombre>

                    <observaciones>2 CONNECTING ROOMS </observaciones>

                    <num_expediente>522687</num_expediente>

                    <forma_pago>25</forma_pago>

                    <telefono/>

                    <res>                   

                        <lin>2¥#1#SS#84.87#0#HB#OK#20120713#20120714#EU#1-2#D01#</lin>

                    </res>

                </parametros>

            </peticion>

        </cfxml>

    Cfdump or xml parse will add one more character (Â) to the xml string. 

    Your comments/answers are welcome.