dbTalk Databases Forums  

mysqlpp and wchar_t problem

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss mysqlpp and wchar_t problem in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
gani b. c.
 
Posts: n/a

Default mysqlpp and wchar_t problem - 10-02-2006 , 03:12 AM






------=_Part_56850_6540397.1159776708715
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

hi..
i have a problem using Query class from mysqlpp with wchar_t. i hope
somebody can help me with this.
i want to insert unicode to table.

here is the sample code

mysqlpp::Connection con( "test", "localhost", "test", "" );
mysqlpp::Query query = con.query();
char * test = "abcdefghij";
wchar_t * wtest = L"abcdefghij";

query << "INSERT INTO tes VALUES( '" << test << "')";
query.execute();

query << "INSERT INTO tes VALUES( '" << wtest << "')";
query.execute();



the char test will gave the right result, 'abcdefghij' inserted to db.
but the wchar_t wtest not give the right result, the record filled with
'004A00F4'.
it seems Query not welcome unicode.
so how can I insert unicode using mysqlpp??

thx.

------=_Part_56850_6540397.1159776708715--

Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: mysqlpp and wchar_t problem - 10-02-2006 , 02:19 PM






gani b. c. wrote:
Quote:
i have a problem using Query class from mysqlpp with wchar_t. i hope
somebody can help me with this.
i want to insert unicode to table.
Read the MySQL++ user manual chapter on Unicode:

http://tangentsoft.net/mysql++/doc/u...l/unicode.html

Short version: by using wchar_t you are going to be using a UCS-2,
UCS-4, UTF-16, or UTF-32 character encoding. (Which it is depends on
your OS, compiler, etc.) MySQL wants UTF-8, a wholly different deal.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.