Treating Binary Blobs As UTF8
Before the introduction of 4-byte UTF-8 character set, MySQL did not support 4-byte UTF8 sequences. This makes it difficult to represent some multibyte languages such as Japanese. To try and alleviate this, MySQL Connector/NET supports a mode where binary blobs can be treated as strings.
To do this, you set the
'Treat Blobs As UTF8'
connection string keyword to
true. This is all
that needs to be done to enable conversion of all binary blobs to
UTF8 strings. To convert only some of your BLOB columns, you can
make use of the
'BlobAsUTF8ExcludePattern' keywords. Set these
to a regular expression pattern that matches the column names to
include or exclude respectively.
When the regular expression patterns both match a single column,
the include pattern is applied before the exclude pattern. The
result, in this case, is that the column is excluded. Also, be
aware that this mode does not apply to columns of type
VARBINARY and also
do not apply to nonbinary
This mode only applies to reading strings out of MySQL. To insert
4-byte UTF8 strings into blob columns, use the .NET
Encoding.GetBytes function to convert your
string to a series of bytes. You can then set this byte array as a
parameter for a