Reply to PHP charset á é í ó ú

Your name:

Reply:


Posted by SM on 02/06/07 20:29

Im so confused with the character encoding and charset stuff.

I'm building an XML file in PHP using the DOM and i'm using characters
like á é í ó ú. I believe those character can be render with the
charset 'ISO-8859-1' wihtout the need of 'UTF-8', right?

So, how come when i preview it in Firefox, Explorer i get those weird
characters like ? or ? .... instead of the actual á é í ó ú ?

I've tried using these header in the php file, with no success:
header ("Content-Type: text/xml; charset=iso-8859-1");

also when i created the DOM, i've tried using these, with no success:
$dom = new DOMDocument('1.0', 'iso-8859-1');

Can someone explain this character encoding stuff

Heres part of my code:
---------------------------------------------------------
<?php
//set the outpout content type as xml
header ("Content-Type: text/xml; charset=iso-8859-1");

//create the DOM document
$dom = new DOMDocument('1.0');

// create the root <discography> element
$discography = $dom->createElement('discography');
$dom->appendChild($discography);

....


//create a new <track> and append it to <tracks>, add the <position>
attribute to <track>
$track = $dom->createElement('track');
$trackText = $dom->createTextNode('Canción');
$track->appendChild($trackText);
$tracks->appendChild($track);
---------------------------------------------------------

Thanks
SM

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация