MySQL Forums
Forum List  »  Newbie

Re: Problem with Accented characters while migrating SQL server to MySql server
Posted by: Rick James
Date: August 31, 2014 11:02AM

A character set conversion is optionally done as the data is stored.

You must start by knowing what encoding is coming out of the source database.

SET NAMES ___ -- to that encoding, so that MySQL knows how to convert as it INSERTs.

The database/table/column CHARACTER SET definitions can be whatever you want; the SET NAMES causes it to convert from the source encoding to whatever definition is on the column you are writing into.

> All data with accented character has been truncated.

That will happen on INSERTs when the source is latin1 bytes but have SET NAMES utf8. This is because you are incorrectly saying the bytes are utf8. In this case, you should have said SET NAMES latin1.

Terminology:
* latin1 and utf8 are "CHARACTER SETs". They specify the bit representations.
* latin1_general_ci and utf8_general_ci are "collations". They specify ordering (eg, case folding for all the "_ci" collations; bit-by-bit comparision for "_bin" collations).
* latin1_general_ci works _only_ with latin1; utf8_general_ci with utf8; etc.

Options: ReplyQuote


Subject
Written By
Posted
Re: Problem with Accented characters while migrating SQL server to MySql server
August 31, 2014 11:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.