WordPress之部份漢字唔得存檔

Wordpress之部份漢字唔得存檔近嚟係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

  1. 登入phpMydamin
  2. 『一般設定』General Settings
  3. 改『伺服器連線編碼與排序』Server connection collation揀 utf8mb4_unicode_ci

 

資料表utf8mb4

  1. 登入phpMydamin
  2. 『伺服器』server->『資料庫』Database
  3. 撳『結構』Structure
  4. 勾『全選』Check
  5. 撳『操作』Operations
  6. 改『編碼與排序』Collation揀 utf8mb4_unicode_ci
  7. 勾『更改所有資料表編碼與排序』Change all tables collations
  8. 勾『更改所有資料表欄位編碼與排序』Change all tables collations collations
  9. 撳『執行』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

 

評論