cjackson111 Posted December 27, 2011 Share Posted December 27, 2011 Hello all. I have a php script that creates an xml file pulled from a mysql database. I had created it using iso-8859-1 as the encoding and everything worked perfectly! However, the client wants it encoded at UTF-8. $_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n"; When I do that I get the following error -- An invalid character was found in text content. Error processing resource 'http://www..... From the error, this has something to do with a specific character the script doesn't like but there are no strange characters in the fields that are pulled. Any ideas what may be the problem? I would greatly appreciate any help! Link to comment https://forums.phpfreaks.com/topic/253907-xml-encoding/ Share on other sites More sharing options...
Maq Posted December 27, 2011 Share Posted December 27, 2011 I would suggest fixing it from the root, create and store the XML documents as UTF-8. It's really what you should be doing anyway, even if it's for the sake of universality. Link to comment https://forums.phpfreaks.com/topic/253907-xml-encoding/#findComment-1301673 Share on other sites More sharing options...
cjackson111 Posted December 27, 2011 Author Share Posted December 27, 2011 That's what I want to do, fix it from the root, but I am not sure what to do to fix it. Any ideas? Link to comment https://forums.phpfreaks.com/topic/253907-xml-encoding/#findComment-1301709 Share on other sites More sharing options...
Maq Posted December 28, 2011 Share Posted December 28, 2011 I would assume specifying the XML document as UTF-8 when creating it and database table, should fix it. Link to comment https://forums.phpfreaks.com/topic/253907-xml-encoding/#findComment-1301871 Share on other sites More sharing options...
cjackson111 Posted December 29, 2011 Author Share Posted December 29, 2011 That's what I thought, but when I started specifying it as UTF-8, that is when I started getting the error. Link to comment https://forums.phpfreaks.com/topic/253907-xml-encoding/#findComment-1302159 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.