Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Problems with danish char in database

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 4/6/2008 1:12:00 PM

Tine Müller wrote:
> I have made some improvements. Now all the markers can be find. The only 
> problem now is making æ ø å instead of an ?.
> 
> I changed:
> // Start XML file, create parent node
> //$dom = new DOMDocument("1.0");
> $dom = new DOMDocument('1.0', 'utf-8');

Have you followed this advice
   "Note: DOM extension uses UTF-8 encoding. Use utf8_encode()  and 
utf8_decode() to work with texts in ISO-8859-1 encoding or Iconv for 
other encodings."
in the documentation <URL:http://www.php.net/manual/en/ref.dom.php>?


That means for instance you need to do

header('Content-Type: application/xml');
$doc = new DOMDocument();
$doc->appendChild($doc->createElement('root'));
$doc->documentElement->appendChild($doc->createTextNode(
utf8_encode('æ ø å')));
echo $doc->saveXML();

So unless your data from the database comes out as UTF-8 you need to 
make sure you encode it first before passing it to any DOM methods like 
createTextNode or setAttribute.


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent