简体   繁体   English

将多字节字符从MSSQL服务器迁移到MySQL

[英]Migrating Multibyte Characters from MSSQL sever to MySQL

I am writing PHP scripts to migrate data from Microsoft SQL Server to MySQL, this has been smooth so far, except multibyte characters. 我正在编写PHP脚本以将数据从Microsoft SQL Server迁移到MySQL,到目前为止,除多字节字符外,这种情况一直很顺利。 can somebody help me to get over with this. 有人可以帮我克服这个问题。 What are the points that should be taken care of from PHP and MySQL database perspective. 从PHP和MySQL数据库的角度来看,应该注意哪些方面。

  1. Do i have to make some changes in MySQL configuration? 我必须在MySQL配置中进行一些更改吗?
  2. Do i have to change character encoding in PHP for multibyte characters, if yes how? 我是否需要更改PHP中多字节字符的字符编码,如果是,怎么办?
  3. Is there anything else i am missing? 我还有什么想念的吗?

Thanks. 谢谢。

I recently added a translation module for our company's website. 我最近为我们公司的网站添加了翻译模块。 I did the following to make sure the DB was up for multibyte goodness 我进行了以下操作以确保DB达到了多字节优势

  1. Setting encoding and collation to UTF8 将编码和排序规则设置为UTF8
  2. Make sure your MySQL connection is configured to accept UTF8 characters. 确保您的MySQL连接配置为接受UTF8字符。 You can do this by running the query SET NAMES utf8 prior to transferring. 您可以通过在传输之前运行查询SET NAMES utf8来做到这一点。 However, there are other ways to do this (I added SET NAMES utf8 because that's how I did it.) 但是,还有其他方法可以做到这一点 (我添加了SET NAMES utf8因为这就是我的方法。)

The following threads have more info 以下线程有更多信息

SET NAMES utf8 in MySQL? 在MySQL中设置名称utf8?

Whether to use "SET NAMES" 是否使用“设置名称”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM