所有的表都在utf_unicode_ci.
我这样做是为了检查
SELECT table_schema, table_name, column_name, character_set_name, collation_name
FROM information_schema.columns
WHERE collation_name <> 'utf8_unicode_ci' AND table_schema LIKE 'my_database'
ORDER BY table_schema, table_name, ordinal_position;
Run Code Online (Sandbox Code Playgroud)
并转换每个表以防万一
ALTER TABLE `my_database`.`table_name` DEFAULT COLLATE utf8_unicode_ci;
ALTER TABLE `my_database`.`table_name` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Run Code Online (Sandbox Code Playgroud)我的数据库整理设置在utf8_unicode_ci.
charsets是
mysql> show variables like 'char%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results …
我想将电子邮件地址编码为其相应的字符代码,因此在打印时,浏览器会解释字符代码,但机器人会获取编码的字符串而不是解释的字符串。
例如(1):
abc@abc.com
Run Code Online (Sandbox Code Playgroud)
应按 (2) 发送到浏览器(添加空格以便浏览器显示):
a ;b ;c ;@ ;a ;b ;c ;. ;c ;o ;m ;
Run Code Online (Sandbox Code Playgroud)
所以人类读(1)而网络机器人读(2)
应该有一个简单的功能或方法来做到这一点,但找不到。