Open EdwardZZZ opened 7 years ago
"😁".charCodeAt(0).toString(16) "d83d"
"😁".charCodeAt(1).toString(16) "de01"
String.fromCodePoint(0xd83d, 0xde01) "😁"
在非utf8mb4的mysql中,会导致数据库异常 可用( /[\ud800-\udbff][\udc00-\udfff]/g )的方式判断然后用encodeURI("😁")转码后保存到数据库中
详细描述见 https://github.com/EdwardZZZ/articles/issues/23
/[\ud800-\udbff][\udc00-\udfff]/ 匹配UTF-16 字符
"😁".charCodeAt(0).toString(16) "d83d"
"😁".charCodeAt(1).toString(16) "de01"
String.fromCodePoint(0xd83d, 0xde01) "😁"
在非utf8mb4的mysql中,会导致数据库异常 可用( /[\ud800-\udbff][\udc00-\udfff]/g )的方式判断然后用encodeURI("😁")转码后保存到数据库中
详细描述见 https://github.com/EdwardZZZ/articles/issues/23