近嚟係Wordpress寫『𨳒𨳊𨶙𨳍閪』『𡳞』漢字唔得存檔,直接對MYSQL寫漢字彈『Warning: #1366 Incorrect string value: ‘…’ for column ‘post_content’ at row 1』.表明係MYSQL編碼關係, 因漢字皆轉為UTF8編碼,多數漢字占3Byte,細心睇『𨳒𨳊𨶙𨳍閪』『𡳞』占4Byte .所以MYSQL先有utf8mb4編碼嚟存檔4Byte特殊字符.
早先Wordpress生成MYSQL時係utf8後嚟轉咗utf8mb4. 所以早先Wordpress漢字唔得存檔.睇wp-config.php文檔.
解决方法唯有將uft8_unicode_ci改成utf8mb4_unicode_ci
伺服器utf8mb4
- 登入phpMydamin
 - 『一般設定』General Settings
 - 改『伺服器連線編碼與排序』Server connection collation揀 utf8mb4_unicode_ci
 
資料表utf8mb4
- 登入phpMydamin
 - 『伺服器』server->『資料庫』Database
 - 撳『結構』Structure
 - 勾『全選』Check
 - 撳『操作』Operations
 - 改『編碼與排序』Collation揀 utf8mb4_unicode_ci
 - 勾『更改所有資料表編碼與排序』Change all tables collations
 - 勾『更改所有資料表欄位編碼與排序』Change all tables collations collations
 - 撳『執行』GO
 
| 早先wp-config.php | 後嚟wp-config.php | 
| define(‘DB_CHARSET’, ‘utf8’); | define(‘DB_CHARSET’, ‘utf8mb4’); | 
| define(‘DB_COLLATE’, ”); | define(‘DB_CHARSET’, ‘utf8mb4_unicode_ci’); | 
| Warning: #1366 Incorrect string value: ‘\xF0\xA8\xB3\x92\xF0\xA8…’ for column ‘post_content’ at row 1 | 
| Warning: #1366 Incorrect string value: ‘\xF0\xA8\xB3\x92\xF0\xA8…’ for column ‘post_title’ at row 1 | 
