MyODBC 3.51.11 and unicode support.

MyODBC 3.51.11 and unicode support.

am 29.08.2005 11:21:12 von vos

------_=_NextPart_001_01C5AC7B.00362538
Content-Type: text/plain;
charset="koi8-r"
Content-Transfer-Encoding: quoted-printable

MyODBC 3.51.11 doesn't support Unicode API, but Mysql 4.1 supports =
Unicode. If you would like to save Unicode strings into Mysql using, you =
could save your Unicode (UTF-16) as UTF-8. The internal format of mysql =
for Unicode string is UTF-8. =9A

=20

Next line tells =9Amysql server that clients would like to use utf-8 for =
sql statement.

=20

pCmdChange->CommandText =3D L"SET NAMES 'utf8'";

pCmdChange->Execute(NULL,NULL,adCmdText);

=20

pCmdChange->CommandText =3D L"SET CHARACTER SET utf8";

pCmdChange->Execute(NULL,NULL,adCmdText);

=20

Save your UTF-16 data into mysql.

=20

sprintf(szBuffer2,"INSERT INTO TempWorkCenter VALUES ('%s', '%s', =
'%s')",=20

šššššššššš=9A '', 'Unicode string UTF-16 as char =
array', '');

=20

pCmdChange->CommandText =3D szBuffer2;

pCmdChange->Execute(NULL,NULL,adCmdText);

=20

To query you data from Mysql to the same and use MultiByteToWideChar to =
convert UTF-8 to UTF-16.

=20

Best regards,

Vasiliy O Stepanov

=20


------_=_NextPart_001_01C5AC7B.00362538--