2010/05/24

MySQL 5.1.x & unicode

In our recent upgrade from 5.0 to 5.1.47, the new version behaves differently and it screw up character set when user submit info from our web app powered by .NET.

After digging around for a afternoon, this is how to fix it:

vi /etc/my.cnf


And add those lines to the config:

init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
default-character-set=utf8
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake


There are other options for collation besides utf8_general_ci such as utf8_unicode_ci. See this article:
http://dev.mysql.com/doc/refman/5.1/en/charset-unicode-sets.html

Reference: http://rhyous.com/2009/11/05/how-to-create-a-utf-8-unicode-database-on-mysql/

沒有留言:

Mercury簡易改裝

有同好有一樣的困擾 - 如何使用自己的data logging軟體,因此寫了這篇來分享我的簡易改裝。 Background 雲豆子 MERCURY roaster 烘豆機的設計是使用自行開發的軟體,來:1. 操控風門/火力; 2. data logging/自動烘焙。 ...