[Bug] MySQL issue and a temporary solution
I hope this thread might be helpful to some friends suffering the same problem .
These days, I updated my pixelpost to 1.7.1 and also moved to a new MySQL server
running MySQL 5.0.45 from a server running MySQL 4.0.
Then I found titles, comments which based on UTF-8 encoding are totally mussy.
The strange thing is that all the stuff are shown correctly when i view the MySQL
database with mysqladmin, but I got mussy thing when i visit my blog with internet browsers.
2. Search "function start_mysql", then you will find it at about Line 492.
3. go to the end of this function, add the following line:
mysql_query("SET CHARACTER SET 'utf8'"); //added by QmQ
4. save,upload and overwrite the old function.php file.
The reason is that the default character set's setting of MySQL is a little tricky.
Use the following SQL command, you are able to see your setting:
SHOW VARIABLES LIKE 'character_set_%';
for example, this is my setting
Here, you can see the character_set_server is "latin1", not utf8.
And "character_set_server" is the default character set for a connection to database.
That is the reason we got some strange characters--pixelpost will use "latin1" to
connect to a utf-encoding database.
So, we got the reason. However, I don't have right to change my character_set_server to utf8.
So I added some codes to use utf8 as the character_set when pixelpost
connecting to the database -- It will "tell" pixelpost to use utf8 as the default
Last edited by QmQ; 02-01-2008 at 06:56 AM.
QmQ, your solution is not temporary, this is a permanent solution as it is the correct way to set your databases encoding type when you cannot do so otherwise.
Future versions of Pixelpost may come with this along with a configurable option to set the blogs site/db encoding site-wide. Until then, continue using your modification.
Pixelpost Documentation | Visual Pixels | My Addons | Transition Bottlerocket Fund
I would highly recommend to use the built-in function of php:
as it is the recommended way. Alternately you should do:
SET NAMES 'utf8' SET CHARACTER SET 'utf8'
any roadmap for this? seems to be already one year old..