Re: XML with BOM and PHP for Flash Gallery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I think that utf8_encode() and utf8_decode() are the solution.

Use utf8_encode($string) before write, and utf8_decode($string)
 to read.

Try to use an extension like SimpleXML to load and save the XML file,  and to
 avoid encoding problems, instead of fwrite(), file_put_contents() ...

=]

======================================
Jony dos Santos Kostetzer

Pesquisa & Desenvolvimento /  Research & Development
A2C Internet para Negócios  / A2C Internet to Business
www.a2c.com.br
======================================

Em Dom 08 Jan 2006 03:13, Konstantinos Christodoulakis escreveu:
>  Hello to all and Happy New Year !
>
>  I have a problem with UTF-8 chars in a flash movie !!!
>
>  I'm using an external XML for Flash Movie.
>  This XML constructed from the following PHP code:
>
>  Code:
>  <?php
>
>        while ($list_result = $this->recordSet->setRow($result)) {
>
>        $this->xml->roottag->curtag->add_subtag('category', array('name'
>  => $this->recordSet->cdata = $list_result[0], 'description' => '',
>  'thumb' => '', 'allowed' => 'true') );
>
>        $tag = &$this->xml->roottag->curtag->curtag;
>
>                    
>  $this->xml->roottag->curtag->curtag->add_subtag('image',
>  array('filename'=> $this->recordSet->cdata = $list_result[5],
>  'productname'=> $this->recordSet->cdata = $list_result[1],
>  'productdescription'=> $this->recordSet->cdata = $list_result[2],
>  'productsubtitle'=> $this->recordSet->cdata = $list_result[3],
>  'productprice'=> $this->recordSet->cdata = $list_result[4]));
>       }
>
>        $xml_file = fopen($filename, "w" );
>        $this->xml->write_file_handle( $xml_file );
>
>     }
>
>  }
>  ?>
>
>
>  I'm also using:
>
>  Code:
>  function write_file_handle( $fh, $write_header=1 )
>      {
>          if ($write_header) {
>              fwrite( $fh, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" );
>          }
>          # Start at the root and write out all of the tags
>          $this->roottag->write_file_handle( $fh);
>      }
>
>
>  The result is an XML file not saved as a UTF-8.
>
>  How can I save it as UTF-8 compatible with Flash Movie (whch uses BOM
>  UTF-8 XML Files as external sources)>
>
>  Is utf8_encode() a solution?
>  Which is the syntax for this?
>  How can I use it in my case?
>  I'm very confused as I'm new to PHP development.
>
>  My best reards,
>  Konstantinos
>
>
>
>
>
>
>
>  PHP Data object relational mapping generator
>  http://www.metastorage.net/
>
>
>
>  YAHOO! GROUPS LINKS
>
>
>  Visit your group "php-objects" on the web.
>  
>  To unsubscribe from this group, send an email to:
>  php-objects-unsubscribe@xxxxxxxxxxxxxxx
>  
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.






PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux