List:General Discussion« Previous MessageNext Message »
From:Gleb Paharenko Date:January 23 2006 2:49pm
Subject:Re: mysql and utf8
View as plain text  
Hello.

Have a look here:
  http://dev.mysql.com/doc/refman/5.0/en/mysql-real-escape-string.html

devy wrote:
> Hi list,
> 
> I'm having some problems while trying to save into a TEXT field some data
> containing text and special characters from a C program!
> I thought to convert the special characters with UTF8 but I don't know how
> to write the SQL-query to insert data in the following table:
> 
> CREATE TABLE `books`
> (
>   `id` int(11) NOT NULL auto_increment,
>   `txt` text character set latin1 NOT NULL,
>    PRIMARY KEY  (`id`),
>    FULLTEXT KEY `txt` (`txt`)
> ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC
> 
> this because I should convert all characters to utf8 and I would convert
> only the special one! For example I would like to do:
> INSERT INTO books (txt) VALUES('exa \xC3\xAE mple');
> 
> but this will result in: "exa xC3xAE mple"!
> 
> I know that I can do:
> INSERT INTO books (txt) VALUES(concat('exa', convert(0xC3AE using utf8)
> ,'mple'));
> but I need a way to write this query without the use of concat (like the
> first example) by converting special characters in a format understood by
> mysql as UTF8 and preserving the others characters!
> Is there a way?
> 
> Thanks,
> Devy
> 


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   Gleb.Paharenko@stripped
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com
Thread