Log in

View Full Version : Resolved How to display special characters in XML driven photo / caption gallery



zeech26
07-08-2009, 08:52 PM
Hello!
I have a question about XML in flash.
I have a photo gallery that utilizes XML to call out the photo as well as the caption.
See XML data below:

<image thumb="thumb/FACILITY_TMB_BATH-02.jpg" big="big/FACILITY_LG_BATH-02.jpg" title="Ogni cottage è dotato di un bagno elegante" />


This is the AS that calls for the photos and captions (The whole script is very long, so I am only going to annote the part that calls for the XML): It goes like this:

xml.load("xml/io/io_resort_gallery01.xml");
for (var i = 0; i<numOfItems; i++) {
var t = this.attachMovie("item", "item"+i, i+1);
}

My problem is that the data won’t display special characters like “è or é or ñ”
I am worried because I am using multiple languages, and as it is I am having to remove important characters from translations...

I also have a second AS that calls for XML data for body copy which which works great, displays all characters in multiple languages, and allows HTML code to be used:

XML Data:
<texts>
<text><![CDATA[<b><font size="14">Il lusso fa parte dell'alloggio...</font></b>
Con 15 lussuosi cottage, siamo in grado....]]></text>

ActionScript:
stop();
my_xml = new XML();
my_xml.load("xml/io/io_resort_text_galleries.xml");
my_xml.onLoad = my_function;
my_xml.ignoreWhite = 1;

function my_function() {
acc_mc.accomodations.html = true;
acc_mc.accomodations.htmlText = my_xml.firstChild.childNodes[0].firstChild.nodeValue;
}

Any idea on how to get the XML for the photo gallery to display all characters?
This is also going to have to accomodate russian and Japanese so I am bit nervous...
Thanks for your help in Advance!
From Santa Cruz, CA
Zeech26

evan
07-08-2009, 09:13 PM
smack me if you tried this already but:

Can you set the formatting of the text box where the xml will go to use an embedded font?

zeech26
07-08-2009, 09:35 PM
Evan, I had not tried that, and it seemed like a great idea until it didn't work!
Thanks for your response. I think it has to do with the coding of the XML, but i'm still stumped...
Help!
thanks
zeech

punstc
07-09-2009, 01:41 PM
Have you tried urlencoding your special characters? I know using text files you need to do this to see special characters it's most likely the same with xml. here's a link to a chart that has all the codes.

http://i-technica.com/whitestuff/urlencodechart.html

If your not familiar with urlencoding just put the code the chart says in place of the letter.

zeech26
07-09-2009, 04:14 PM
"Have you tried urlencoding your special characters? I know using text files you need to do this to see special characters it's most likely the same with xml. here's a link to a chart that has all the codes."

I tired that, it displayed the character as written in the URL code unfortunately.
I am thinking that I have to incorporate CDATA in the XML file, but I am not sure how to do that. with this type of gallery.

Thanks for your help, that is great for future reference.
Anybody else have any ideas?
Thanks again,
zeech

zeech26
07-09-2009, 05:54 PM
Evan, I figured it out.
I added this to the actionscript:
system.useCodepage = true;

And then, like you suggested, I went back and embedded the characters (latin)
cheers!
zeech