#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Reading special characters from XML in flash


    I have a php file that generates an xml, the php file:

    Code:
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    </head>
    <?php
    ...
    $directorio1 = utf8_encode($directorio);
    $dir1 = utf8_encode($dir);
    $string = "<nombre>$dir1$directorio1</nombre>\n";
    $write = fputs($fp, $string);
    ...?>
    An xml generated with the following structure:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <elementos>
    <elemento>
    <nombre>PROYECTOS/VIVIENDAS/Arturo Soria/P9120205.JPG</nombre>
    <id>0</id>
    <tam>376</tam>
    </elemento>
    ...
    <elemento>
    <nombre>SHOWROOM/DISEŅOS PROPIOS/8099 entera(2).jpg</nombre>
    <id>34</id>
    <tam>156</tam>
    </elemento>
    </elementos>
    In Flash CS5 I try reading and loading from the tag :

    Code:
    var ldr:Loader = new Loader();
    ldr.load(new URLRequest(decodeURIComponent(nombre)));
    And doesn't find the file for the element containing the Ņ.

    I've also tried the following:

    Code:
    ldr.load(new URLRequest(escape(nombre)));
    
    ldr.load(new URLRequest(unescape(nombre)));
    
    ldr.load(new URLRequest(nombre));
    without any success.

    I also tried changing the encoding of the XML:

    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    But still not working. Anyone knows what I can do to solve this?
  2. #2
  3. No Profile Picture
    Gotta get to the next screen..
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2003
    Location
    Legion of Dynamic Discord
    Posts
    6,678
    Rep Power
    3164
    Hi, try HTML encoding the character in question. I use this site for that. You can use PHPs htmlentities function to do that.
    Last edited by Tann San; May 26th, 2011 at 03:48 AM.
    Quis custodiet ipsos custodes?
  4. #3
  5. No Profile Picture
    Gotta get to the next screen..
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2003
    Location
    Legion of Dynamic Discord
    Posts
    6,678
    Rep Power
    3164
    More info on how to use utf8_encode and htmlentities together is here.
    Quis custodiet ipsos custodes?

IMN logo majestic logo threadwatch logo seochat tools logo