Page 1 of 1
PHP UTF8 problem
Posted: Thu Dec 11, 2008 2:52 am
by skrt
I'm heaving a problem with an rss php generator, It was written for Joomla 1.0 and now i want to use it in Joomla 1.5 but i have a problem that i don't know how to solve. The old Joomla database had character set to latin1 and the new one has UTF8, so every time when i run generator.php on new Joomla i get weird signs instead of correct UTF8 characters in my feed.xml file. A friend suggested that i add a "query SET NAMES (utf8)" but i don't know where to put it so that it will work correctly.
Re: PHP UTF8 problem
Posted: Thu Dec 11, 2008 4:52 am
by Eran
Before you make any queries add those two queries:
Code: Select all
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER SET utf8");
Also, how did you convert your database from latin1 to utf8? if you didn't do it properly you might have damaged some special characters.
Re: PHP UTF8 problem
Posted: Thu Dec 11, 2008 6:16 am
by skrt
In which line do i put this queries that you wrote? I already try something similar and got an error. Sorry im a newbie as far as PHP concerns, but im learning
For transfer i used Joomla migrator. I also run the generator.php on the clean Joomla 1.5 installation and the result was the same. I also tried and manually replaced the signs in feed.xml and save the file in UTF8 without BOM and the characters worked. So the problem apparently must be generator.php in how reads the database / writes the feed.xml
Re: PHP UTF8 problem
Posted: Thu Dec 11, 2008 6:20 am
by Eran
In which line do i put this queries that you wrote?
Before you make any queries add those two queries
It doesn't matter where, just make sure it is before any other query.
Re: PHP UTF8 problem
Posted: Thu Dec 11, 2008 6:28 am
by skrt
i added it to the line 35 and now works
Thank you pytrin for your help
