mysql removes carriage returns, blanks, newlines, and horizontal tabs from data

1. When importing utf-8 encoded txt files into the database, you may encounter the situation of importing invisible characters (carriage return, line feed) into the data, so the query will be invalid, then you can use update and replace to replace these characters.

UPDATE 表名 SET  列名 = REPLACE(REPLACE(REPLACE(REPLACE(列名, CHAR(10), ''), CHAR(13), ''), CHAR(9), ''),' ','');

in:

    char(9) horizontal tab character 

    char(10) newline

    char(13) carriage return

    Remove spaces replace('field',' ','')

My sql statement is:

UPDATE points SET  intent = REPLACE(REPLACE(REPLACE(REPLACE(intent, CHAR(10), ''), CHAR(13), ''), CHAR(9), ''),' ','');

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325236564&siteId=291194637