Re: xml first special char

From: Date: Sat, 17 Sep 2005 04:10:06 +0000
Subject: Re: xml first special char
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-222569@lists.php.net to get a copy of this message
----- Original Message ----- From: "Joerg P" <superbla3000@gmx.net> To: <php-general@lists.php.net> Sent: Friday, September 16, 2005 2:07 PM Subject: [PHP] xml first special char
hello, I have some words with german special chars in mysql. When I print those strings direct as xml to the browser, everything seems fine. But there is one 'ä' that makes me crazy. It always appears as a ? in Firefox and even makes an error in ie. But other 'ä's are ok..... What could I do? Joerg have you tried changing the encoding in firefox to see if it fixes the ?
If that works try enforceing that encoding. Either with a header(); and/or <?xml encoding=""?> I use this function to set the header information in most if not all of my websites You can safely ignore the $this->outXML I use that because I mainly work with XSL documents. appending a ?xml to some of my sites will give you the raw XML perfect for debugging purposes. :) function outputHeader($docType='', $filename=null) { if (!$this->outXML) { header("Content-Type: text/html; charset=utf-8"); echo '<?xml version="1.0" encoding="utf-8" ?>'."\n"; echo ($docType != '')? $docType: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 //EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'."\n"; } elseif ($this->outXML) { header("Content-Type: text/xml; charset=utf-8"); } else { header("Content-Type: $docType; charset=utf-8"); if (!empty($filename)) { header('Content-Disposition: attachment; filename="'.$filename.'"'); } if ($docType=="text/xml") { echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; } } }
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#222569) next »