alxhere Posted May 16, 2009 Share Posted May 16, 2009 Hey, hope somebody can help me here cause i can't figure out what i'm doing wrong! So following situation: I'm trying to export a xml file from a mySQL Database being handled by Joomla 1.5 CMS. Connecting to the database, exporting the Data from the MySQL tables to a simple PHP Script and creating a XML File is not a problem, everything is running fine. Bear in mind that the content of the DB Tables is in greek. I generate the XML file using fopen ('main.xml','w' ) then store all the data in a string and use fwrite($fmain,$str) to write the data in the xml file. Problem is that the content i get from the MySQL Tables appears as '? ? ? ? ?' (Questionmarks) in the xml file. The weird thing about this is that : $str="äääööööΛΑσδκαλσκδα" appears normally in the XML File , the problem occurs only when i make a MySQL query and assign the transferred values to the string.. The encoding of the db is UTF8_general_ci, the encoding of the XML File UTF8 as well... I hope somebody understood what i just said! Thanks for your time, alex Link to comment https://forums.phpfreaks.com/topic/158434-solved-yet-another-xml-php-question-problem-encoding/ Share on other sites More sharing options...
alxhere Posted May 17, 2009 Author Share Posted May 17, 2009 Hey, hope somebody can help me here cause i can't figure out what i'm doing wrong! So following situation: I'm trying to export a xml file from a mySQL Database being handled by Joomla 1.5 CMS. Connecting to the database, exporting the Data from the MySQL tables to a simple PHP Script and creating a XML File is not a problem, everything is running fine. Bear in mind that the content of the DB Tables is in greek. I generate the XML file using fopen ('main.xml','w' ) then store all the data in a string and use fwrite($fmain,$str) to write the data in the xml file. Problem is that the content i get from the MySQL Tables appears as '? ? ? ? ?' (Questionmarks) in the xml file. The weird thing about this is that : $str="äääööööΛΑσδκαλσκδα" appears normally in the XML File , the problem occurs only when i make a MySQL query and assign the transferred values to the string.. The encoding of the db is UTF8_general_ci, the encoding of the XML File UTF8 as well... I hope somebody understood what i just said! Thanks for your time, alex For whom it may concern (i saw that a lot of people faced the same problem) Solution: -------- After connecting to the Database use mysql_query("SET NAMES utf8") All encoding problems will disappear cheers!! alex Link to comment https://forums.phpfreaks.com/topic/158434-solved-yet-another-xml-php-question-problem-encoding/#findComment-835595 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.