更改 MySQL 中的字符集可能会导致失败? [英] Potential downfalls from changing character set in MySQL?

查看:35
本文介绍了更改 MySQL 中的字符集可能会导致失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用?"对问题进行故障排除时出现在 Web 应用程序生成的 PDF 中的标记,我发现数据库的字符编码混杂.大多数是拉丁语,有些是 utf,还有一些是其他的.

In troubleshooting a problem with "?" marks that appear in a web application generated PDF, I've discovered that the database has a mismash of character encodings. Most are latin, some are utf, and a few are something else.

在提到这个优秀的问题和一系列回复时(在 my.cnf 中将 MySQL 默认字符集更改为 UTF-8? ),我现在对接下来需要发生的事情有了相当清楚的了解.我不完全清楚的是,通过 ALTER TABLE 更改 my.cnf 和表本身的字符集是否可能会破坏数据或创建其他问题".我正在处理数百个表和大约 10GB 的数据.

While referring to this excellent question and array of responses ( Change MySQL default character set to UTF-8 in my.cnf? ), I now have a fairly clear idea of what needs to happen next. What I'm not entirely clear on is whether changing the character set in my.cnf and on the tables themselves via ALTER TABLE would potentially destroy data or create other "gotchas". I'm working with hundreds of tables and about 10gb of data.

这通常是一个安全"的程序吗?

Is this generally a "safe" procedure to undertake?

推荐答案

发帖已经 45 天了,没有人回答,所以我会发一个链接,指向 Nic Jansma 关于他从 Latin1 转换为 UTF-8 的经验.

It's been 45 days since posting and no answers, so I will post a link to a very thorough and informative article written by Nic Jansma on his experience converting from Latin1 to UTF-8.

注意这个警告:

"如果您只是将列强制转换为 UTF-8 而没有 BINARY 转换,MySQL 会对您的latin1"进行数据更改转换字符转换为UTF-8",最终会被错误地转换数据."

"If you simply force the column to UTF-8 without the BINARY conversion, MySQL does a data-changing conversion of your "latin1″ characters into "UTF-8″ and you end up with improperly converted data."

可以在此处找到该文章.

这篇关于更改 MySQL 中的字符集可能会导致失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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