将MySQL输出的十六进制字符串转换为UTF-8编码

3

这个可以使用UTF8

create temporary table test (x char(1) not null) charset=utf8;
insert into test select x'c3a9';
select hex(x), x from test;
drop table test;

输出

+--------+---+
| hex(x) | x |
+--------+---+
| C3A9   | é | 
+--------+---+

但是这使用的是默认字符集,而不是 utf8

SELECT x'c3a9';

我该如何修改上述一行代码,以便输出UTF-8编码的字符 é 而不是 é

1个回答

5

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接