MySQL的某些字符扼杀和MSSQL不 [英] mysql chokes on certain characters and mssql not
本文介绍了MySQL的某些字符扼杀和MSSQL不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是过滤字符串数据的好方法,以免在这样的插入操作中不会出现致命错误?
What's a good way to filter string data so that we don't get a fatal error at an insert operation like this?
ERROR: SQL FAILS: Incorrect string value: '\x92s]' for column 'looseterm' at row 1
Failing SQL is INSERT INTO `looseterms` (`looseterm`) VALUES ('[loose_terms:indonesia’s]')
有人知道到底是什么吗?'\x92s]'
是什么,这对mysql来说很重要吗?
Ms-Sql没问题.
Does anyone know what the heck '\x92s]'
is and what is it so dear to mysql to choke on it?
Ms-Sql got no problems with it.
推荐答案
设置您的连接字符集到您的文字编码所在的字符集.例如,对于UTF-8
:
Set your connection character set to that in which your literals are encoded. For example, for UTF-8
:
SET NAMES 'utf8';
If different literals are in different encodings, you can specify the character set of those not in the connection character set with an introducer:
INSERT INTO ... (_utf8'[loose_terms:...');
这篇关于MySQL的某些字符扼杀和MSSQL不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文