TwelvestoneFlash

PHP, XML, Flash and utf-8


Sign in

  • Waiting for Godot ( 720 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 4.8 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.8 k posts )
    general front end design an...
  • Back End ( 9.6 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
JERKSTORE
 
2006-09-20

I have data in a mysql database. It gets extracted via PHP, formatted into an XML file, and sent to Flash. This process works fine, except that special characters - specifically accented letters - don't work.

The html page my main flash movie sits on has a charset of utf-8:

My xml file is formatted as utf-8: <?xml version="1.0" encoding="UTF-8"?>

Hell, even the PHP that generates the XML file is formatted as utf-8: <?php header("Content-type: text/xml; charset=utf-8");

If I navigate directly to my php file that outputs the XML, and view that XML output, the special characters show up correctly. But once inside of Flash, they show up as incorrect characters. For instance, the following string from XML: Café Espresso

Is rendered like so once inside of Flash: Caf© Espresso

I even added this to my Flash file: System.useCodePage = true;

But I get no change.

All of the text in my Flash file is using a Font Symbol in a shared library, so my dynamic text will render smoothly across multiple movies. The font included is simply Arial, so it's certainly a font that should contain special characters, but is it possible they weren't included when the font symbol was created?

This seems like it must be a flash problem, since viewing the XML file by itself shows the correct characters...?

I'm at a loss for a solution to this.

JERKSTORE
 
2006-09-20

By the way, I did run across Keavy's thread that appeared to be very similar to this, but after seemingly setting everything to use the utf-8 charset, my problem still persists...

persist
 
2006-09-20

Look and see what happens with system font. If system font shows correct you've an embed issue.

other than that, it's tough to debug these.

JLM
 
2006-09-20

just some ideas...

have you checked it with just normal embedding as shared fonts are not easy to work with.

A good start with embedding is

Basic Latin Latin I Cyrillic

although you may not need all of thoughs, then if a particular character is a problem then using character map (if in windows) and copy and paste it into the extra characters.

Check it is not a bold and you have only embeded normal, make sure you upload all files to server as binary not ascii and use CDATA tags in the XML. Check the character actually exists in the char set since some mac to pc fonts are not compleate

you could check what character gets into flash, tracing its number rather than it to the trace window with a for loop.

lastly in desperation you could type the charater in a textfield in flash and then do a split.join swap if the char code is such and such a number!

JERKSTORE
 
2006-09-20

Well, this is weird. We refresh this particular site every 3 or 4 months, so I have lots of old backup files from previous iterations.

So, if I reupload one of the older flash files, the character encoding issues go away and the characters show up without issue. The interesting part is, the ONLY difference between the old .fla and the new .fla is that the old one was created in Flash MX 2004, and the new file was subsequently saved in Flash 8.

Both are set to export for the Flash 6 player, but any .swf exported from Flash 8 fails to render the characters correctly.

If I copy the old file, and open it and export from Flash 8, the problems arise again. Even if I open in Flash 8, but do a Save As back to a Flash MX 2004 file, the problems still show up. But if I edit the file in Flash MX 2004, then I have no problems with special characters.

This is very weird.

persist
 
2006-09-22

HAzaa.

That reply has more clues.

Open help in Flash Studio 8.

In the search dialog type: Creating custom character sets

click on that topic when it finds it. Do not be afraid and follow the instructions.

THis method of informing the player of char sets is actually the more traditional manner, and one of the kind of things you need to get used to if ever you go into more classical environments such a flex 2 or AMES where build files inform the compiler.

jspit
 
2010-04-19

Hi

I'm new to this blog and I was trying to implement the above I have created a directory called gallery and place all images, gallery.php and index.php and gallery.swf

From my browser when I call index.php nothing comes up

this is my gallery.php file

<?php $xml = '<?xml version="1.0"?'.'>';

$filepath = "./gallery"; $handle = opendir($filepath); while (false != ($file = readdir($handle))) { $pic = @getimagesize($filepath."/".$file); if($pic != false && $pic[2] == 2){ $xml .= ''; echo($xml);

}
}

echo $xml; closedir($handle); ?>

this is the index.php

Flash Photo Stack " />

and this is the xml file

<?xml version="1.0"?>

Can someone help me please? Why are the images not coming from browser but they will be displayed if i run gallery.swf ?

Thanks Jesmond

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

PHP, XML, Flash and utf-8