Hello,
My xml file (encoding=UTF8) is generated from a mysql database via a php script. The dynamic text field in flash displays '"' . I've made sure the the font is embedded. Any suggestions?
Thanks, JD
I had the very same problem, plus some others with special characters in flash, like html stuff. I solved it making a function to rebuild the HTML and other special chars like the ampersand (this is waht you'll need the most)
First make sure if you have the quotation marks this way ", if they are, make sure the content is between a CDATA block and change the " entities for the actual quotation marks, like this
-
<sometag><![CDATA[The content goes here, put the quotation marks like "this".]]></sometag>
-
In some part of your code in the flash file add this function:
-
function rebuildHTML(theText:String):String {
-
var tempText:String = theText;
-
var chunks:Array = new Array();
-
-
chunks = tempText.split("<");
-
tempText = chunks.join("<");
-
chunks = tempText.split(">");
-
tempText = chunks.join(">");
-
chunks = tempText.split("&");
-
tempText = chunks.join("&");
-
-
chunks = tempText.split("href="");
-
tempText = chunks.join("href=\"");
-
chunks = tempText.split("">");
-
tempText = chunks.join("\">");
-
return tempText;
-
}
-
This function rebuilds the basic HTML tags, all the "<" and ">", the link tags and the ampersand.
Look here:
chunks = tempText.split("&");
tempText = chunks.join("&");
Here is where I change the & character to the actual "&". Flash does the following. When flash encounters a lliteral quotation mark it changes to the entity ", the same with the ampersand if it finds a " it replace the & in the quot entity for an & so it reads " and that's just worg. So with this function we solve that problem.
Now, how should you use it?
Instead of asinging the value of the xml node directly into the variable or text object instace like you would normally do, you should asing it the function passing as the parameter the xml node avalue, cause the function returns the text parsed:
-
//instead of doing this:
-
b.htmlText = nodes[i].firstChild.firstChild.nodeValue;
-
-
//you do this:
-
b.htmlText = rebuildHTML(nodes[i].firstChild.firstChild.nodeValue.toString());
-
Try it and let me know wether it works.
Regards!