先创建转换函数
···
DROP FUNCTION IF EXISTS unicode_decode;
DELIMITER $$
CREATE FUNCTION unicode_decode(content TEXT)
RETURNS TEXT
BEGIN
DECLARE code1,code2 VARCHAR(20);
DECLARE n_index,s_index SMALLINT UNSIGNED DEFAULT 0;
DECLARE result,tmp_txt TEXT;
DECLARE temp VARCHAR(1);
SET s_index=LOCATE("\u", content,1);
SET result = “”;
WHILE s_index>0 DO
SET code1 = CONV(SUBSTRING(content,s_index+2,2),16,10);
SET code2 = CONV(SUBSTRING(content,s_index+4,2),16,10);
SET temp = CONVERT(CHAR(code1,code2) USING ‘ucs2’);
SET tmp_txt = SUBSTRING(content,n_index+1,s_index - (n_index+1));
SET result = CONCAT(result,tmp_txt,temp);
SET n_index = s_index+5;
SET s_index = LOCATE("\u", content, s_index+1);
END WHILE ;
SET tmp_txt = SUBSTRING(content,n_index&