Welcome Guest, Not a member yet? Register   Sign In
Can't solve strange problem with encoding, urgent help needed
#1

[eluser]Base Willy[/eluser]
Hi to all Igniters!

I've got a pretty strange problem.

Let's have a look at http://my.pitomec.ru/test - there we can see serialised data from session table created by OB Session. The problem is that sometimes this data comes in a wrong encoding. Not always, but sometimes pretty often. Is you press F5 several times you could see that sometimes there are squares instead of cyrillic text.

Database is in utf8_general_ci and i do "SET NAMES utf8" and that problem appears just here, in the session. That causes an error during unserializing data and session doesn't work well Sad

Let's try to find why does that happen.

Thanks in advance!
#2

[eluser]Base Willy[/eluser]
Small update: when data is not in utf8, it's in win1251
whyyyyyy?!
#3

[eluser]Base Willy[/eluser]
I've just figured that everyone except me saw only blank page at http://my.pitomec.ru/test , sorry :-) Just fixed it and now you can see the trouble.. help steel wanted
#4

[eluser]Base Willy[/eluser]
Ahhh nevermind, i've figured it out:-)

Session creates a separate database connection and it didn't do "set names utf8", added it and everything fine at lastSmile
#5

[eluser]Derek Allard[/eluser]
LOL! This is the strangest thread I've read in a while Wink

I look forward to you sharing your experience with others on the forums base willy, and glad you got it solved.
#6

[eluser]Base Willy[/eluser]
Well at least I've made someone laugh, Derek:-)
#7

[eluser]autoreverse[/eluser]
Glad you found a solution. I do all my work in UTF-8 so until a fix is available (see http://ellislab.com/forums/viewthread/61656/) I've hacked CodeIgniter/database/drivers/mysql/mysql_driver.php as follows:
Code:
// --------------------------------------------------------------------

    /**
     * Select the database
     *
     * @access    private called by the base class
     * @return    resource
     */    
    function db_select()
    {
        $result = @mysql_select_db($this->database, $this->conn_id);

        // Unicode, UTF8, utf-8 hack
        if ($result) @mysql_query("SET NAMES 'utf8'");

        return $result;
    }
#8

[eluser]Base Willy[/eluser]
autoreverse, thanks, that seems like a good one too




Theme © iAndrew 2016 - Forum software by © MyBB