#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    17
    Rep Power
    0

    Question UTF-8 problem in 4.1.1a


    Hi
    I'm trying to use the new capabilities of the MySQL 4.1.1a, which is supporting of Unicode. I prefer to use UTF-8 instead of UCS-2 since I'm working on web and for web UTF-8 is much more suitable.
    Before asking my current question, I would like to say that before this version of MySQL I was storing data in data bases encoded in UTF-8. I had no problem, all was fine, storing, retrieving and compares. The only problem (which is not a problem, but a lack) was about using FullText search on UFT-8 fields since this search takes out the unnecessary characters from the index, and most of my characters are not in the specified range (since it’s UTF-8). I hoped this was solved in the new one.
    My current question:
    I'm trying to insert data into a table and my data, before insertion, is encoded in UTF-8. I've created a table like this:

    CREATE TABLE `articles` (
    `id` INT NOT NULL AUTO_INCREMENT,
    `article` TEXT CHARACTER SET utf8,
    PRIMARY KEY (`id`),
    FULLTEXT (`article`)
    )


    And then tried to insert data like this:

    INSERT INTO `articles` (`id`, `article`) VALUES ('', _utf8 'مهران')

    My string to store is an Arabic word, which in UTF-8 it takes two bytes per letter. All first bytes in each letter is 0x06 which is the ‘?’ character in ASCII. The problem is that all data stored in data base will be ‘?’. It means that only the first bytes are stored, from each character entered.
    So, am I doing anything wrong or there’s a problem with MySQL itself?

    Thanks in advance,
    Mehran Ziadloo
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    17
    Rep Power
    0
    And to see the above script correctly, change your encoding to uft-8.

IMN logo majestic logo threadwatch logo seochat tools logo