ID #1130

Do I need to SET NAMES to display characters of my language?

No, you won't. SQLyog does all what is required!

With the introduction of SQLyog version 6 SQLyog always uses UTF8 internally. Whenever SQLyog communicates with Windows strings are transformed to (or from) the native Windows (UTF16) Unicode implementation and whenever connecting to the MySQL server SQLyog issues "SET NAMES utf8" statement. That is all what is required. No matter with what character set data are stored on the server, the server itself will transform between the character set used for storing of data and the unicode/utf8 character set used by SQLyog on the client side.

Actually you SHOULD NEVER issue any SET NAMES statement from the SQLyog GUI yourself. You may experience the SQL statements sent by SQLyog will be 'garbled' and will not be understood by the server. Imagine "SELECT" becoming "#¤@£€%+" in your statements...

Also you may damage your data. That would in particular happen with accented (non-English/non-ASCII) latin characters. Those characters are encoded differently in utf8 and in non-unicode character sets. If SQLyog sends utf8-data but the server 'thinks' it is something else, those characters will garble.

And again: how data are stored on the server does not matter. The communication between MySQL and SQLyog (including SJA) ensures that both the 'server side' and 'client side' use of character sets is correct. It is totally 'automatic'. And do not interfere in that!

However if you execute a SQL-script from a file you may include a SET NAMES statement in that file. You will need to do if character data in the file are not encoded with the server default charset. When SQLyog executes an external file, a separate connection is created for that and SET NAMES in that file will not affect the connection that the GUI uses. SQL scripts generated by SQLyog are UTF8-encoded and the file contains a "SET NAMES utf8" statement. But if the script is generated with another program it is not necessarily the case.

The above applies to MySQL from version 4.1. Before that MySQL does not support SET NAMES. With MySQL 3.23 and 4.0 SQLyog will simply receive a 'binary copy' of what is stored on the server. The computer must be using a LOCALE setting matching the stream of data.

Categories for this entry

Tags: -

Related entries:

You can comment this FAQ