List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:February 14 2005 3:03pm
Subject:Re: UNICODE
View as plain text  
dienw wrote:

> I apologize if this is a frequent topic.

It is frequently discussed on the main MySQL list.  You should be 
monitoring that as well, since most of this topic is generic to the C 
API, and wrapper APIs like MySQL++ just "inherit" the underlying behavior.

> I'd like to know, how can I query the database containing
> UNICODE character? My application will use wide char. I'm confused
> with the interfacing to the mySQL through mysql++.

It's my understanding that the C API uses UTF-8 as its data 
representation.  So, the only trick is getting from your wide-character 
strings* to UTF-8 before inserting those strings into the database.  For 
instance, if you're using the SSQLS feature of MySQL++, you could have 
something like this:

	wstring some_data = mumble();
	SQL_MyRow row;		// created with sql_create... macro
	row.string_field = utf8(some_data);
	Query q = conn.query();
	q.insert(row);

[*] I believe you can use the C++ template std::wstring here, which is 
probably UCS2 or UCS4 on your system.  Check your local C++ 
documentation.  Using true wide characters in memory is reasonable; 
UTF-8 is useful mainly for backwards-compatibility with C code, and for 
efficient data transfer.

> Thanks in advance for any answers.

Thanks in advance for your report telling us whether/if it works as I 
described.  :)  I haven't had a reason to use Unicode yet, but I'm 
seeing some pressure to start, so I hope you can blaze some trail for me.
Thread
UNICODEdienw12 Feb
Re: UNICODEWarren Young14 Feb
  • RE: UNICODEdienw15 Feb