Skip navigation
Wave cult
Currently Being Moderated

Ouput xml content using xmlParse

May 5, 2012 10:38 AM

Tags: #output #characters #encoding #utf-8 #special #xmlparse

Hello,

 

I generated a xml file in UTF-8 format which is right readeable using IE9.

This file contains some accented character and in IE9 these characters are all readeable.

After parsing this file using xmlParse and obtaining the resulting array, i try to show the content of one memo field present in an array element but the accented characters are substituted by a wrong rappresentation (like a wrong encoding).

I check (by the browser) that the page is rightly UTF-8 encoded like the xml file.

Why the accented characters are not shown in the right way despite the xml file and the page are UTF-8 encoded ?

 

Thanks,

Davide

 
Replies
  • Currently Being Moderated
    May 6, 2012 12:25 AM   in reply to Wave cult

    When you say, "i try to show the content of one memo field present in an array element", what should we understand by show? Do you mean using cfoutput?

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 1:10 AM   in reply to Wave cult

    Similar to BKBK's reaction... instead of describing your code, show us your code.  Or at least a code snippet that demonstrates/replicates your problem.  It's unlikely we can guess what your problem is, which is what you're relying on us doing without letting us see some code that demonstrates what you're talking about.

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 2:05 AM   in reply to Wave cult

    Ah, right.  Gotcha.

     

    There's a bug in xmlParse() in that when reading from the file system, it doesn't understand that files can have different encoding schemes.  Sad but true.

     

    See the ticket I've raised with Adobe here:

    https://bugbase.adobe.com/index.cfm?event=bug&id=3183072

     

    Short version: use fileRead() to read the file, then xmlParse() the result.

     

    NB, according to CF, you have a bug in your XML:

    <?xml version="1.0" encoding="UTF-8" standalone="true"?>

     

    The standalone attribute value must be one of yes or no, not true or false (this was on CF 9.0.1).

     

    This is borne out by the guidance by the W3C: http://www.w3.org/TR/REC-xml/#sec-rmd

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 5:52 AM   in reply to Adam Cameron.

    Splendid job, Adam. I have voted to have the bug fixed.

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 6:00 AM   in reply to Adam Cameron.

    Adam Cameron. wrote:

     

    use fileRead() to read the file, then xmlParse() the result.

    Meaning, of course, fileRead() with an encoding attribute of "UTF-8" (as you yourself point out in the bug report). Without the  encoding attribute, fileRead misbehaves just like xmlParse.

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 1:17 PM   in reply to BKBK

     

    use fileRead() to read the file, then xmlParse() the result.

    Meaning, of course, fileRead() with an encoding attribute of "UTF-8" (as you yourself point out in the bug report). Without the  encoding attribute, fileRead misbehaves just like xmlParse.

     

    Yeah, sorry, I thought that was obvious from what I was saying, but it's perhaps a good idea to make it crystal clear.

     

    --

    Adam

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points