ITPub博客

首页 > 数据库 > > dbase mysql,mysql中的奇怪字符dbase

dbase mysql,mysql中的奇怪字符dbase

作者:gaokeke123 时间:2022-03-23 15:08:50 0 删除 编辑

When I type strange characters like é or ë and store it in a mysql dbase; the character will be converted to: é

It probably will have to do something with my character set. But i don't now where to start.

On top of the page i inserted:

The collocation of the field in the dbase is: utf8_unicode_ci

Displaying the field in a webpage results in é and ë but displaying them in a textarea results in é

How can i change this?

解决方案

Make sure the collation for the columns, tables and the database are all set to utf8_unicode_ci or utf8_general_ci

You also have to keep in mind, in addition to the meta directive that you already have, to extract and insert entries to and from the database in the same encoding.

Include this line right after you've made the call to connect to the database:

mysql_query("set names 'utf8'");

This will keep the character set properly as UTF-8 state as you manipulate and extract entries in the database.

来自:https://blog.csdn.net/weixin_39608559/article/details/118811583

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26692020/viewspace-3134141/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
大家好

注册时间:2013-08-14

  • 博文量
    1432
  • 访问量
    31612