How to enter Unicode strings?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul van Rossem

    How to enter Unicode strings?

    How does one enter Unicode strings into a 5.0.3 MySQL table?
    I tried things like
    INSERT INTO tablename(colna me) VALUES( _utf8'€©®á§A¦n' )
    But this doesn't work. I guess I need an escape sequence, but the MySQL
    manual doesn't specify Unicode escape sequences, just for quotes,
    newlines and such...

    Thanks, Paul.
  • sbailey@sb.net

    #2
    Re: How to enter Unicode strings?

    Following example shows how you specify Unicode character set. This is
    copied from the MySQL online manual at


    It was posted there, in the "User Comments" section of that page, by
    Robert Mark Bram on September 26 2003:


    Simple example:

    CREATE TABLE `family` (
    `name` varchar(100) NOT NULL,
    `savings` decimal(3,2) NOT NULL default '0.00',
    `dob` date NOT NULL default '0000-00-00',
    PRIMARY KEY (`name`),
    UNIQUE KEY `name` (`name`)
    ) TYPE=InnoDB CHARACTER SET utf8
    ;

    Comment

    • Paul van Rossem

      #3
      Re: How to enter Unicode strings?

      Thanks for your reply, but this was not my question. I know how to
      define the table, but there seems to be no way whatsoever filling the
      table with actual Unicode strings (except programmaticall y through an
      SQL driver, but not from a script or command line).

      There just is no syntax for defining Unicode string constants with
      characters other than (extended) ASCII. I would expect something like
      the HTML escape sequence 水 or the Java "\u6c34" escape sequence,
      but they forgot to define something like that...

      Paul.

      On 26-04-2005 23:34, sbailey@sb.net wrote:[color=blue]
      > Following example shows how you specify Unicode character set. This is
      > copied from the MySQL online manual at
      > http://dev.mysql.com/doc/mysql/en/charset-unicode.html
      >
      > It was posted there, in the "User Comments" section of that page, by
      > Robert Mark Bram on September 26 2003:
      >
      >
      > Simple example:
      >
      > CREATE TABLE `family` (
      > `name` varchar(100) NOT NULL,
      > `savings` decimal(3,2) NOT NULL default '0.00',
      > `dob` date NOT NULL default '0000-00-00',
      > PRIMARY KEY (`name`),
      > UNIQUE KEY `name` (`name`)
      > ) TYPE=InnoDB CHARACTER SET utf8
      > ;
      >[/color]

      Comment

      • boonkit@gmail.com

        #4
        Re: How to enter Unicode strings?

        This article may help you


        Comment

        Working...