Re: [PHP] Error in Building an XML File
On Mon, 2009-03-09 at 16:26 +, Nathan Rixham wrote: > Joe Harman wrote: > > On Mon, Mar 9, 2009 at 9:53 AM, Bob McConnell wrote: > >> From: Joe Harman > >>> I am using PHP to build an XML file, but I keep on getting an XML > >>> error when open the file in Google Chrome. > >>> > >> > >> - > >>> This page contains the following errors: > >>> > >>> error on line 30 at column 318: Entity 'iuml' not defined > >>> Below is a rendering of the page up to the first error. > >>> > >> > >> > > > > Okay, Thanks... appears the problem is that I have foreign language > > entities in my HTML... Ugh > > > > I am sure this is not really the most efficient way to do this, but I > > tried using the following to get rid of these, but it appears that it > > just converts them to this i¿½... > > > > $search = > > explode(",","ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u"); > > $replace = > > explode(",","c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u"); > > $decode_string = str_replace($search, $replace, > > html_entity_decode($row_rsFeed['full_desc'])) > > > > I am going to read up some more on sanitizing HTML > > > > Joe > > you need to be dealing with encodings here; whats the encoding of the > original content? iso-8859-1? - in short what you need is to convert all > "text" to be utf-8, more than likely utf8_encode($whatchaNeed) will get > you going in right direction. > > regards! Couple of ways to get round this: 1. Define the entity in a DTD for the XML 2. Put the raw character in the output (i.e. Ï) 3. Write the character as you have done, but put it inside a block Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error in Building an XML File
Joe Harman wrote: On Mon, Mar 9, 2009 at 9:53 AM, Bob McConnell wrote: From: Joe Harman I am using PHP to build an XML file, but I keep on getting an XML error when open the file in Google Chrome. - This page contains the following errors: error on line 30 at column 318: Entity 'iuml' not defined Below is a rendering of the page up to the first error. Okay, Thanks... appears the problem is that I have foreign language entities in my HTML... Ugh I am sure this is not really the most efficient way to do this, but I tried using the following to get rid of these, but it appears that it just converts them to this i¿½... $search = explode(",","ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u"); $replace = explode(",","c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u"); $decode_string = str_replace($search, $replace, html_entity_decode($row_rsFeed['full_desc'])) I am going to read up some more on sanitizing HTML Joe you need to be dealing with encodings here; whats the encoding of the original content? iso-8859-1? - in short what you need is to convert all "text" to be utf-8, more than likely utf8_encode($whatchaNeed) will get you going in right direction. regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error in Building an XML File
On Mon, Mar 9, 2009 at 9:53 AM, Bob McConnell wrote: > From: Joe Harman >> >> I am using PHP to build an XML file, but I keep on getting an XML >> error when open the file in Google Chrome. >> > > - >> This page contains the following errors: >> >> error on line 30 at column 318: Entity 'iuml' not defined >> Below is a rendering of the page up to the first error. >> > > >> Okay, Thanks... appears the problem is that I have foreign language entities in my HTML... Ugh I am sure this is not really the most efficient way to do this, but I tried using the following to get rid of these, but it appears that it just converts them to this i¿½... $search = explode(",","ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u"); $replace = explode(",","c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u"); $decode_string = str_replace($search, $replace, html_entity_decode($row_rsFeed['full_desc'])) I am going to read up some more on sanitizing HTML Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Error in Building an XML File
From: Joe Harman > > I am using PHP to build an XML file, but I keep on getting an XML > error when open the file in Google Chrome. > - > This page contains the following errors: > > error on line 30 at column 318: Entity 'iuml' not defined > Below is a rendering of the page up to the first error. > > > is this something to do with document encoding? Entity errors are almost always caused by a bare ampersand in a URL. You need to convert them to &. Since this error occurs, there may also be other errors in the encoding. You need to read up on URL and HTML sanitization. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error in Building an XML File
> I am using PHP to build an XML file, but I keep on getting an XML > error when open the file in Google Chrome. > - > This page contains the following errors: > > error on line 30 at column 318: Entity 'iuml' not defined > Below is a rendering of the page up to the first error. > > > is this something to do with document encoding? > > I am using these as headers for the script > > header("content-type:text/xml;charset=utf-8"); > header("Content-Disposition:attachment;filename=google_feed.xml"); > > hi Joe, the document encoding has nothing to do with the error. maybe you have & just before the "iuml". make it ï. or maybe copy and paste that line here because i suspect there is something else. Virgil http://www.jampmark.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error in Building an XML File
Hello, I am using PHP to build an XML file, but I keep on getting an XML error when open the file in Google Chrome. - This page contains the following errors: error on line 30 at column 318: Entity 'iuml' not defined Below is a rendering of the page up to the first error. is this something to do with document encoding? I am using these as headers for the script header("content-type:text/xml;charset=utf-8"); header("Content-Disposition:attachment;filename=google_feed.xml"); Thanks Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php