unicode and (maybe) colaltion issue

Discussion in 'MySQL' started by ferdousx, Feb 16, 2009.

  1. #1
    I made a script which converts a unicode character into its hexadecimal equivalent and insert into database. The problem is it woked when i test in my local windows pc lamp environment but not when i use it in my linux server. The problem is that data is converted rightly(i am guessing it cause i am using the same script) but is inserting differently when i am inserting it in my linux server's database.

    I checked the settings in this 2 database and see one difference in settings. My local testing server has collation connection(Global value),collation database and collation server as 'latin1_general_ci' where these 3 setting in host server is 'latin1_swedish_ci'. Is this setting is affecting how the unicode hexa value is storing in database? if yes, how can i change these value into 'latin1_general_ci. If not, what could be the issue?

    thanks for your time.
     
    ferdousx, Feb 16, 2009 IP
  2. gnp

    gnp Peon

    Messages:
    137
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use one of these two command to alter the collation of
    all columns in the database: ALTER TABLE mytable CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci
    or
    a specific column in a table: ALTER TABLE Table1 MODIFY column1 VARCHAR(xx) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

    reference: http://dev.mysql.com/doc/refman/5.0/en/charset-column.html

    hope this helps ..
     
    gnp, Feb 16, 2009 IP