duansai1314 2019-07-30 07:23
浏览 129

如何在Mysql中使用like运算符搜索法语单词?

French words are saving in to database like-

   Sécurité Informatique

The original word is - Sécurité Informatique

How to search this word using LIKE '%Sécurité Informatique%'

I have already tried mysqli_real_escape_string and

WHERE table.content COLLATE UTF8_GENERAL_CI LIKE '%Sécurité Informatique%'
  • 写回答

2条回答 默认 最新

  • doujuan2688 2019-07-30 07:54
    关注

    First you need to insert your data correctly to your database then you can search for it. For doing that you should use correct encoding, which is UTF8 for your usage.

    How ? It depends on how you are connected to your database Some examples :

    For MySQLi:

    mysqli_set_charset($conn, "utf8mb4");
    

    For MySQLi OOP :

    $conn->set_charset("utf8mb4");
    

    Also you need to specify you are using UTF-8 In your client side(HTML) with :

    <meta http-equiv="Content-type" content="text/html;charset=utf-8" />
    

    The reason why we used utf8mb4 instead of utf8 is utf8 in MySQL is outdated and use 3 bytes but utf8mb4 is the correct utf8 and uses 4 bytes.

    评论

报告相同问题?

悬赏问题

  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真