mysql中的奇怪字符dbase [英] Strange characters in mysql dbase

查看:203
本文介绍了mysql中的奇怪字符dbase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我键入é或ë等奇怪字符并将其存储在mysql dbase中时;该字符将被转换为:é

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:

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

dbase中字段的并置是:utf8_unicode_ci

The collocation of the field in the dbase is: utf8_unicode_ci

显示网页中的字段会产生é和ë,但在textarea中显示它们会导致é©

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

如何更改? >

How can i change this?

推荐答案

确保列,表和数据库的排序规则都设置为 utf8_unicode_ci utf8_general_ci

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.

您已经拥有的meta 指令可以在数据库中提取和插入条目。

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

mysql_query("set names 'utf8'");

这将使字符集正确设置为UTF-8状态,因为您在数据库中操作和提取条目

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

如果您可以下次使用,从一开始就拥有UTF-8的所有内容

If you can for next time, have everything in UTF-8 from the very start.

这篇关于mysql中的奇怪字符dbase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆