Part of the EllisLab Network
   
 
Database sessions with special char in user_data
Posted: 20 November 2008 06:47 PM   [ Ignore ]  
Summer Student
Total Posts:  15
Joined  11-18-2008

Hello.

When the session set up to use database, the serialized user_data is broke, when try to serialize a special character, like ‘é’, or ‘ó’.
The problem only appear, when session use database, and user_data contain special character!

Profile
 
 
Posted: 24 February 2009 12:15 PM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  15
Joined  11-18-2008

Hello.

I find the solution.

If the char encode of session table in the database is different, or wrong (i.e. the session table is latin_1 and the session data is UTF-8), the session serialize will mess width the special characters.

A little message in the documentation at this part will be kindly appreciated.

Profile
 
 
Posted: 26 February 2009 04:00 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  40
Joined  10-14-2008

Thx for your contribution.

I had the same problem, and your fix works perfectly.

Profile
 
 
Posted: 26 February 2009 09:14 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2280
Joined  07-30-2007

I really don’t see why there needs to be any additional documentation on this. In config/database.php your clearly define the charset and collation for your database - why would you then go make a table in that database different?

$db['default']['char_set'"utf8";
$db['default']['dbcollat'"utf8_general_ci"

If we start warning people about common sense things like this, we’ll need to start warning them about:

<?php unlink('/')?> 
 Signature 

Follow me on twitter here.
MichaelWales.com | MichaelWales.info

Profile
 
 
Posted: 27 February 2009 06:11 AM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  15
Joined  11-18-2008

Yes, you right, but if the developer use phpmyadmin or orher surfaces to develop SQL, may overlook the proper setup of all char encodes - it’s not so noticeable, and the problem usually not appear at the first round in most cases.
But, as I see, this tread is perfect to warn.

Thank you.

Profile