mysql emoji图片存储

mysql

nickname varchar(1024) character set uft8mb4 collate uff8mb4_unicode_ci default null comment '用户昵称'

java

存数据库之前

URLEncoder.encode(nickname,'utf-8');

返回前段之前

URLEncoder.decode(nickname,'utf-8');

 

记录log的情况

//替换4个字节的utf-8编码(此范围编码包含emoji)
reqContent = reqContent.replaceAll("[\\ud800\\udc00-\\udbff\\udfff\\ud800-\\udfff]", "??");

猜你喜欢

转载自www.cnblogs.com/zfzf1/p/11831666.html