I have a problem dealing with Utf8. I've already altered the database and tables to be like below:
       mysql>alter database database_name character set Utf8 collate utf8_unicode_ci;
       mysql>alter table table_name character set Utf8 collate utf8_unicode_ci;
when I checked into its variables to show characters configuration and collation configuration, it showed like these:
       mysql> show variables like '%character%';
              +--------------------------+----------------------------+
              | Variable_name            | Value                      |
              +--------------------------+----------------------------+
              | character_set_client     | latin1                     |
              | character_set_connection | latin1                     |
              | character_set_database   | utf8                       |
              | character_set_filesystem | binary                     |
              | character_set_results    | latin1                     |
              | character_set_server     | latin1                     |
              | character_set_system     | utf8                       |
              | character_sets_dir       | /usr/share/mysql/charsets/ |
              +--------------------------+----------------------------+
              8 rows in set (0.00 sec)
       mysql> show variables like '%collation%';
              +----------------------+-------------------+
              | Variable_name        | Value             |
              +----------------------+-------------------+
              | collation_connection | latin1_swedish_ci |
              | collation_database   | utf8_unicode_ci   |
              | collation_server     | latin1_swedish_ci |
              +----------------------+-------------------+
              3 rows in set (0.00 sec)
When I set /etc/my.cnf to be like below, it worked well:
        [mysqld]
        character-set-server=utf8
        [mysql]
        default-character-set=utf8
FYI, here is the code of Utf8 encode on JavaScript:
        var Utf8 = {
            encode : function (string) {
                     string = string.replace(/\r\n/g,"\n");
                      var utftext = "";
                      deleteCookie('unicodeLength');
                      for (var n = 0; n < string.length; n++) {
                      var c = string.charCodeAt(n);
                      if (c < 128) {
                            utftext += String.fromCharCode(c);
                      }
                      else if((c > 127) && (c < 2048)) {
                            utftext += String.fromCharCode((c >> 6) | 192);
                            utftext += String.fromCharCode((c & 63) | 128);
                      }
                      else {
                            utftext += String.fromCharCode((c >> 12) | 224);
                            utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                            utftext += String.fromCharCode((c & 63) | 128);
                      }
               }
            return utftext;
         }
    };
The problem arose when those 2 lines're removed from /etc/my.cnf. Any suggestions?
 
    