EdwardZZZ / articles

工作点滴记录
2 stars 0 forks source link

emoji #17

Open EdwardZZZ opened 7 years ago

EdwardZZZ commented 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

EdwardZZZ commented 5 years ago

/[\ud800-\udbff][\udc00-\udfff]/ 匹配UTF-16 字符