开发者

Converting special character to degree symbol

In my mysql database, i need to convert the special character � into degree symbol. I tried the following command in sql but am getting an error message.

update NOTE set NOTE_VALUE = replace(NOTE_VALUE, 开发者_开发知识库'�', '°');

Error msg:

Illegal mix of collations (latin1_swedish_ci,IMPLICIT), (utf8_general_ci,COERCIBLE), (utf8_general_ci,COERCIBLE) for operation 'replace'.

I need to convert the special character � into the degree symbol.

Any help would be greatly appreciated.

Thanks


You'll need the correct value but you should be able to refer to it by its integer value char(146)

update NOTE set NOTE_VALUE = replace(NOTE_VALUE, char(XXX), '°');

Where XXX is a value you'll need to figure out

This article might be helpful.


As seen there you can try to change the collation of the table (if it's not a problem)

ALTER table note convert to character set utf8 collate utf8_swedish_ci;

You can also try the char() method as mentioned above but with the USING clause (link)

UPDATE NOTE set NOTE_VALUE = replace(NOTE_VALUE, char(XXX USING latin1_swedish_ci), '°');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜