dbase mysql,mysql中的奇怪字符dbase

2022-03-23 00:00:00 专区 订阅 付费 交易 评论

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

相关文章