Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > SUPPORT / INFORMATION > Pixelpost Help

Post Reply
 
Thread Tools
  #1  
Old 02-01-2008, 05:59 AM
QmQ's Avatar
QmQ Offline
forum loafer
 
Join Date: Nov 2005
Location: Hong Kong
Posts: 12
[Bug] MySQL issue and a temporary solution

I hope this thread might be helpful to some friends suffering the same problem .
[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.


[Solution]
1.Open includes/functions.php
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.


[Explanation]
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
================================
character_set_client utf8
character_set_connection utf8
character_set_database utf8
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8
=================================
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
encoding.
__________________
Chaney's Photoblog:
Just Click

Last edited by QmQ; 02-01-2008 at 06:56 AM.
Reply With Quote
  #2  
Old 02-01-2008, 06:39 AM
Dennis's Avatar
Dennis+ Offline
Team Pixelpost
 
Join Date: Jul 2006
Posts: 2,394
Send a message via MSN to Dennis
Thanks for providing this fix. I hope this will be the solution to many problems related to encoding.
__________________
My photoblog, powered by PixelPost 1.9 dev SVN | My Pixelpost Addons | My Cool Photoblog profile
Reply With Quote
  #3  
Old 02-01-2008, 12:30 PM
Dkozikowski's Avatar
Dkozikowski+ Offline
Team Pixelpost
 
Join Date: Oct 2005
Posts: 1,855
Send a message via AIM to Dkozikowski
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.
Reply With Quote
  #4  
Old 02-01-2008, 01:26 PM
QmQ's Avatar
QmQ Offline
forum loafer
 
Join Date: Nov 2005
Location: Hong Kong
Posts: 12
Thanks, I think we can add a configurable option in pixelpost.php -- just like wordpress did in their new version
e.g.:
$pixelpost_db_character_set
__________________
Chaney's Photoblog:
Just Click
Reply With Quote
  #5  
Old 02-01-2008, 02:06 PM
Dkozikowski's Avatar
Dkozikowski+ Offline
Team Pixelpost
 
Join Date: Oct 2005
Posts: 1,855
Send a message via AIM to Dkozikowski
Yeah, something along those lines.
Reply With Quote
  #6  
Old 02-27-2009, 01:57 PM
Günter's Avatar
Günter Offline
forum loafer
 
Join Date: Feb 2009
Posts: 6
I would highly recommend to use the built-in function of php:

http://de2.php.net/manual/en/functio...et-charset.php

as it is the recommended way. Alternately you should do:

Code:
SET NAMES 'utf8'
SET CHARACTER SET 'utf8'
according to http://dev.mysql.com/doc/refman/5.0/...onnection.html

any roadmap for this? seems to be already one year old..
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 10:04 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs