MySQL 将自定义字符集添加到 utf8mb4 而不是 utf8

问题描述 投票:0回答:1

我需要向 MySQL 服务器添加自定义字符集以增强搜索体验,我实际上能够做到,但添加到 utf8_charset 而不是它的 mb4 版本。我什至在 MySQL documentation 中似乎也找不到任何有关 mb4 的内容

正如他们在文档中提到的,我编辑了文件

/usr/share/MySQL/charsets/Index.xml
,并在
<charset name="utf8">
下添加了我的子集,因为我找不到
utf8mb4

的任何子集
 <collation name="utf8_arabic_ci" id="1029">
   <rules>
     <reset>\u0627</reset> <!-- Alef 'ا' -->
     <i>\u0623</i>        <!-- Alef With Hamza Above 'أ' -->
     <i>\u0625</i>        <!-- Alef With Hamza Below 'إ' -->
     <i>\u0622</i>        <!-- Alef With Madda Above 'آ' -->
   </rules>
   <rules>
     <reset>\u0629</reset> <!-- Teh Marbuta 'ة' -->
     <i>\u0647</i>        <!-- Heh 'ه' -->
   </rules>
   <rules>
     <reset>\u0000</reset> <!-- Ignore Tashkil -->
     <i>\u064E</i>        <!-- Fatha 'َ' -->
     <i>\u064F</i>        <!-- Damma 'ُ' -->
     <i>\u0650</i>        <!-- Kasra 'ِ' -->
     <i>\u0651</i>        <!-- Shadda 'ّ' -->
     <i>\u064F</i>        <!-- Sukun 'ْ' -->
     <i>\u064B</i>        <!-- Fathatan 'ً' -->
     <i>\u064C</i>        <!-- Dammatan 'ٌ' -->
     <i>\u064D</i>        <!-- Kasratan 'ٍ' -->
   </rules>
 </collation>

而且它的工作方式就像魅力一样,但是,我无法将我的整个数据库列碰撞从

utf8mb4_unicode_ci
更改为
utf8_unicode_ci
甚至是我的自定义的
utf8_arabic_ci

mysql utf-8 character-encoding arabic arabic-support
1个回答
0
投票

我认为您需要添加一个全新的字符集 请参阅https://dev.mysql.com/doc/refman/8.0/en/ldml-collation-example.html

<charset name="utf8mb4">
  ...
  <collation name="utf8mb4_phone_ci" id="1029">
    <rules>
      <reset>\u0000</reset>
      <i>\u0020</i> <!-- space -->
      <i>\u0028</i> <!-- left parenthesis -->
      <i>\u0029</i> <!-- right parenthesis -->
      <i>\u002B</i> <!-- plus -->
      <i>\u002D</i> <!-- hyphen -->
    </rules>
  </collation>
  ...
</charset>
© www.soinside.com 2019 - 2024. All rights reserved.