While debugging some character encoding issues today, I decided it would help to directly populate a database table with some test strings containing non-latin characters. I hoped the mysql client would, by chance, support C-, Java- or Ruby-style Unicode escape sequences. Alas, it does not.
mysql> select _ucs2 x'2018'; +---+ | ‘ | +---+ mysql> select _ucs2 x'20182019201C201D'; +------+ | ‘’“” | +------+ mysql> select concat(_ucs2 x'2018', 'Hi.', _ucs2 x'2019'); +-------+ | ‘Hi.’ | +-------+
You can also use the variable-length UTF-8 representation (convenient when, for example, copying from a utf-8 URL-encoded value like %E2%80%98
).
mysql> select _utf8 x'E28098'; +---+ | ‘ | +---+