Home · Links · Contact Us
Home arrow Forums
Home
Features
FAQ
Screen Shots
Modules
Demos
Documentation
Forums
Contact Us
Download
Purchase
Quotes

" ... I want to tell you that your thyme product is functional and valuable beyond words. I cannot imagine why any portal would be without it. It is the cornerstone of our new project ..."

" ... Thanks for such a complete project, its making my job much easier. ..."

" ... I have now deployed 4 different calendars and our users love them ... "

" ... Easy to install and use and a great look/design. ..."

" ... This has to be the easiest to use program I think I've had to deal with at all this year. ..."


  FAQFAQ    SearchSearch  RegisterRegister   Log inLog in 
UTF-8 encoding: shouldn't it be set on every DB connection?

 
Post new topic   Reply to topic     Forum Index -> Hacking Thyme
View previous topic :: View next topic  
Author Message
weder



Joined: 05 Oct 2007
Posts: 51

PostPosted: Wed Aug 06, 2008 6:36 pm    Post subject: UTF-8 encoding: shouldn't it be set on every DB connection? Reply with quote

Hi all,

I discovered a problem using a UTF-8 based MySQL database apart from the "key too long" problem described on the FAQ pages of Thyme (and which only strikes during installation, if I'm not mistaken).

Despite proper settings in the DB and DB tables e.g. described here, I still got question marks in my strings. This was due to the actual DB connection opened to MySQL still using the default encoding, which is Latin-1, instead of UTF-8.

Here's a patch that worked for me. Warning: this has not been extensively tested yet. Don't simply do this without knowing what you're doing.

1. Open "thyme/include/classes/sql" with a text editor.
2. Change the query() function so that UTF-8 encoding is used as default on every DB connection.

Aka change the top of function from:

Code:

   function query($strQuery, $numbered = 0)
   {

      $this->qs++;

      $strQuery = trim($strQuery);


to this:

Code:

   function query($strQuery, $numbered = 0)
   {

      $this->qs++;
     
      if(! @mysql_query("SET NAMES 'utf8';", $this->dbHandle)) {
            $this->error_out("query()", mysql_error($this->dbHandle), "<pre>SET NAMES 'utf8';</pre>\n");
            return;
      }
     

      $strQuery = trim($strQuery);


This is only a quick hack. I can apply it on my machine because I know everything in my DB and everything else is UTF-8 - e.g. I've also changed all language files to use UTF-8 instead of ISO-8859-1.

But is this actually something that is missing from the current codebase? Shouldn't the charset of the DB connection be set every time to a possibly configurable value?

Thanks
Andreas
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Hacking Thyme All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
© 2005 eXtrovert software unless otherwise noted. All rights reserved.
Portions © 2004 Ben Brown. All rights reserved.
Trademarks are property of their respective owners.