Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6902

Script For Creating Unicode Fields in MySQL Fails on MariaDB

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Incomplete
    • Affects Version/s: 5.3.12
    • Fix Version/s: N/A
    • Component/s: OTHER
    • Labels:
      None
    • Environment:
      Apache/2.2
      Database client version: libmysql - mysqlnd 5.0.8-dev - 20102224
      PHP extension: mysqli

      Protocol version: 10
      Server charset: UTF-8 Unicode (utf8)
      Server Environment: NearlyFreeSpeech.net

      Description

      The attached SQL script creates a table named "food_items" with an "Ingredients" field that holds Chinese characters without any trouble on MySQL running in the following environment:

      • Window Version 6.01 (Build 7601 : Service Pack 1)
      • MySQL Version: 5.6.20 MySQL Community Server (GPL)

      However, if I run it on MariaDB via phpMyAdmin on NearlyFreeSpech.net, then inserting Chinese characters into the database results in question marks.

      I've included screenshots of the table structure from MariaDB and MySQL.

      The following INSERT statement fails.
      INSERT INTO `cake_ht`.`food_items` (`ID`, `Name`, `Ingredients`, `Comments`) VALUES ('', 'Gai-lan', '芥蘭', NULL);

      Error Message:
      Warning: #1366 Incorrect integer value: '' for column 'ID' at row 1
      Warning: #1366 Incorrect string value: '\xE8\x8A\xA5\xE8\x98\xAD' for column 'Ingredients' at row 1

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            Hi,

            Judging by the collation values visible in the screenshots, in MariaDB instance your columns are of latin1 charset, while in MySQL they are utf8. Did you try to use utf8 in MariaDB, too?

            Show
            elenst Elena Stepanova added a comment - Hi, Judging by the collation values visible in the screenshots, in MariaDB instance your columns are of latin1 charset, while in MySQL they are utf8. Did you try to use utf8 in MariaDB, too?
            Hide
            elenst Elena Stepanova added a comment -

            Closing as incomplete for now. If you have more information, please comment to re-open.

            Show
            elenst Elena Stepanova added a comment - Closing as incomplete for now. If you have more information, please comment to re-open.
            Hide
            Zian Zian added a comment -

            Then we have dueling default character sets.

            I installed MySQL on a stock Windows 7 x86 virtual machine using the MySQL Installer for Windows, ran the CREATE script, and then ran the following:

            INSERT INTO `food_items` (`ID`, `Name`, `Ingredients`, `Comments`) VALUES ('1', 'Gai-lan', '芥蘭', NULL);

            I did not receive an error message and, after performing a SELECT on the food_items table, I could see the Chinese characters correctly.

            I have taken a screenshot of the schema using MySQL Workbench and will attach it.

            Show
            Zian Zian added a comment - Then we have dueling default character sets. I installed MySQL on a stock Windows 7 x86 virtual machine using the MySQL Installer for Windows, ran the CREATE script, and then ran the following: INSERT INTO `food_items` (`ID`, `Name`, `Ingredients`, `Comments`) VALUES ('1', 'Gai-lan', '芥蘭', NULL); I did not receive an error message and, after performing a SELECT on the food_items table, I could see the Chinese characters correctly. I have taken a screenshot of the schema using MySQL Workbench and will attach it.
            Hide
            elenst Elena Stepanova added a comment - - edited

            If you are really using 5.3.12, you're comparing a 2-year-old build (and installer) with the fairly new MySQL version. If you use MariaDB 10.0 which is similar to MySQL 5,6 in terms of being the latest stable release, or at least MariaDB 5.5 which is still closer, you will have the choice of using UTF8 during installation, see the attached screenshot.

            Show
            elenst Elena Stepanova added a comment - - edited If you are really using 5.3.12, you're comparing a 2-year-old build (and installer) with the fairly new MySQL version. If you use MariaDB 10.0 which is similar to MySQL 5,6 in terms of being the latest stable release, or at least MariaDB 5.5 which is still closer, you will have the choice of using UTF8 during installation, see the attached screenshot.

              People

              • Assignee:
                Unassigned
                Reporter:
                Zian Zian
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: