简体   繁体   English

从mysql数据中删除不可见的退格字符

[英]Remove invisible backspace characters from mysql data

I have the following invisible character in my dataset 我的数据集中有以下不可见字符

在此处输入图片说明

Which I believe is this character 我相信这个角色

http://www.fileformat.info/info/unicode/char/0008/index.htm http://www.fileformat.info/info/unicode/char/0008/index.htm

How do I remove this? 我该如何删除? I've tried 我试过了

UPDATE events SET `value` = TRIM(REPLACE(`value`, CONVERT(char(8) USING hp8), ''))

MySQL escape sequence for literal backspace character is \\b . 文字退格字符的MySQL转义序列为\\b

See "Special Character Escape Sequences" here: 请参阅此处的“特殊字符转义序列”:

http://dev.mysql.com/doc/refman/5.7/en/string-literals.html http://dev.mysql.com/doc/refman/5.7/en/string-literals.html


If I needed to remove that character from a string column, I'd use an expression like this: 如果需要从字符串列中删除该字符,请使用以下表达式:

 REPLACE(foo,'\b','')

I'd test that expression in a SELECT statement before I tried an UPDATE, eg 在尝试执行UPDATE之前,我会先在SELECT语句中测试该表达式,例如

SELECT t.foo
     , REPLACE(t.foo,'\b','')` AS new_foo
  FROM mytable t
 WHERE t.foo LIKE '%\b%'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM