PHP UTF8 problem
Moderator: General Moderators
PHP UTF8 problem
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.
Last edited by skrt on Fri Dec 12, 2008 5:48 am, edited 1 time in total.
Re: PHP UTF8 problem
Before you make any queries add those two queries:
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.
Code: Select all
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER SET utf8");
Re: PHP UTF8 problem
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
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
In which line do i put this queries that you wrote?
It doesn't matter where, just make sure it is before any other query.Before you make any queries add those two queries
Re: PHP UTF8 problem
i added it to the line 35 and now works
Thank you pytrin for your help
Thank you pytrin for your help