Part of the EllisLab Network
   
 
Database sessions with special char in user_data
Posted: 20 November 2008 05: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 11:15 AM   [ 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 03:00 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  11
Joined  10-14-2008

Thx for your contribution.

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

Profile
 
 
Posted: 26 February 2009 08:14 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2264
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 

Become a fan of the CodeIgniter Cookbook (estimated: Fall 2010).

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

Profile
 
 
Posted: 27 February 2009 05: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
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120351 Total Logged-in Users: 58
Total Topics: 126476 Total Anonymous Users: 4
Total Replies: 665118 Total Guests: 425
Total Posts: 791594    
Members ( View Memberlist )
Newest Members:  jackmarioRanjanjoyMihai NorthThatchVagariPatient ShareNixnizviVadotlogikCariNet