Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jake on Aug 21, 2009 05:50
open dhtmlx forum
Event text stored in MySQL and UTF8

Hi!
I seem to have encountered a problem with the way DHTMLX Scheduler stores event text data in MySQL. I created my table form your sample, and it seems as the text column has UTF8 charset, which is good. Everything is fine when I enter event text and display them in DHTMLXScheduler.

But the problem is that data seems not to be stored like the rest of my UTF8 data in other tables. All tables are UTF8 with collation utf8_general_ci, but when I look in the database directly, it seems like the UTF 8 data was encoded with Latin1 _before_ it was stored. So, for example, when I have "Ä" in the Scheduler, I can only see "ä" in the database. This is a problem when I later want to get the data from that table to display in other places of my application, cause all I get is those strange looking characters (ä) and not pure UTF8.

On the other hand, if I edit data in MySQL directly and enter, say "Łódź", it all looks good in my entire application except the DHTMLXScheduler, where I instead see "?�d?". So it seems like your product is doing some more converting than necessary and applies some strange encoding. How would you suggest to solve my problem? Thank you for the otherwise great product!

P.S. I already have private $encoding="utf-8"; in my Connector class.
Answer posted by Supoport on Aug 21, 2009 08:38
Connector doesn't make any extra encoding conversion.

During loading it takes data from db, stores it in php string, and then, output it to the client side as xml marked as UTF-8 encoded ( but no any extra conversion applied )
During saving, client side code uses encodeURIComponent to encode data ( with encoding must be unicode safe ) and on server side data placed in string and later in DB without any extra conversion. 

>>I have "Ä" in the Scheduler, I can only see "ä" in the database.
Actually it seems correct for me. There is no single byte symbol for the "Ä" in UTF, so it is encoded as two byte sequence.
( in case, when iso-8859-1 encoding is used , it will be stored as single byte )

Which encoding you are using for html pages, is it UTF as well?
Are you using any non-default extensions for PHP , which may affect encoding?