MySQL Forums
Forum List  »  Connector/ODBC

Re: MySQL ODBC 8.0 Unicode Driver and utf8 - solved
Posted by: Bogdan Degtyariov
Date: August 17, 2021 10:34PM

The characters you use in your string (2-byte or 16-bit) are commonly referenced as wide characters, not multi-byte. The wide characters are always 16 bit, while multi-byte characters can be different than that and they can even be variable length.

ODBC supports two main types: ANSI characters (SQLCHAR type is 8-bit) and Wide characters (SQLWCHAR type is 16-bit). Therefore, the functions that work with ANSI have the A suffix (such as SQLConnectA()) and the functions that work with wide characters have W suffix (such as SQLConnectW()).

When your application is using SQLConnect() the functions are mapped to A or W depending on the Unicode setting in your program.

With UTF8 character set used in MySQL the characters vary from 8 to 24 bits whilst UTF8MB4 can be up to 32-bits. Note that it is different from UTF32 where all characters are of fixed 32-bit length.

Specifying CHARSET=UTF8MB4 allows the ODBC driver to perform the correct conversion from multi-byte variable length characters of UTF8MB4 character set into wide 16-bit characters supported by ODBC.

I hope this clarifies things a bit.

Options: ReplyQuote

Written By
Re: MySQL ODBC 8.0 Unicode Driver and utf8 - solved
August 17, 2021 10:34PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.