Flash CMS v4.71: Character Encoding Problems fixed

December 28, 2009 by: Christian

The issue with proper character encoding has been there for a while. Even though the database tables have “latin1″ as the default character set, I knew this was not the correct solution. But it always worked for me, and I have been using “utf8_encode/utf8_decode” in my php scripts and all was fine. Even though I had to convert some single special characters like the bullet point (•), I could live with that workaround and I used to postpone the problem for ages… Until now. Because a site I’m working on will be in russian and german, and therefor I was confronted with a whole bunch of cyrillic characters… So I had to fix this once and for all.

The funny thing is, it is really simple if you know the right MySQL syntax you have to use. It is not done by setting the “Default Character Set” of  the database tables to “utf8″, which is what I have tried many times before. You have to add 2 more lines before the query.

In PHP, Instead of this:


//......
$query = "SELECT * FROM table";
$result = mysql_query($query);
//.....

…it should look like this:


//......
$query = "SELECT * FROM yourtable";
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES utf8");
$result = mysql_query($query);
//.....

I know this may seem too obvious, but at the time I was trying to solve this I just didn’t find the solution. And as I said, I had a workaround that was fine for a long time.

Another small improvement in version 4.71: skip crop/resize picture
I have added a checkbox in the upload section of the CMS, when you crop/resize a picture. It is now possible to skip the first cropping/resizing and therefor upload a picture “as is” (see the screenshot below). After that, you can still define the thumbnail. Why that? I have a client who is very keen on image quality. Even if I set the quality of imagemagic to 100%, the image quality loss was to big for the client, and even worse, the image became to large in file size. So now the client can prepare the image in photoshop, upload it as it is and just use the thumbnail functionality of the CMS to create the thumbnail, where quality does not matter that much.

flash-cms-skip-crop-resize-picture

Download the Turtlebite Flash CMS here.

Cheers,
Christian

Trackbacks

Leave a Reply

Comment Spam Protection by WP-SpamFree