標籤:png 我的連結 rac har message users sof span mysq
之前以為mysql設定utf-8以及暱稱decode後就萬事大吉了,結果最近才發現對於4位元組的表情會報錯。
報錯資訊如下:
data: null
message: " ### Error updating database. Cause: java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x98\x86\xF0\x9F...‘ for column ‘nickName‘ at row 1 ### The error may involve com.smallfoxdog.demo.mapper.UserMapper.insertUser-Inline ### The error occurred while setting parameters ### SQL: insert into users(id,wxOpenid,nickName,avatarUrl,gender,province,city,country,continue_days) values(NULL,?,?,?,?,?,?,?,1) ### Cause: java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x98\x86\xF0\x9F...‘ for column ‘nickName‘ at row 1 ; uncategorized SQLException; SQL state [HY000]; error code [1366]; Incorrect string value: ‘\xF0\x9F\x98\x86\xF0\x9F...‘ for column ‘nickName‘ at row 1; nested exception is java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x98\x86\xF0\x9F...‘ for column ‘nickName‘ at row 1"
status: 200
timestamp: 1526283581431
__proto__: Object
errMsg: "request:ok"
header: Object
解決方案:52627223(註:他裡面有2個sql我執行失敗,但是一樣也改好了)
但是看其他文章說資料庫連接的時候去掉編碼格式,目前我的連結地址如下,去掉了characterEncoding=utf8,測試成功
下面是修改後遊戲中的效果已經可以正常顯示表情了
mysql存表情出錯的解決方案(類似\xF0\x9F\x98\x86\xF0\x9F)