Re: set names 'utf8'
Posted by: Shuichi Tamagawa
Date: September 30, 2005 11:45AM

danielmcbrearty

As is often the case, I guess your program is using default mysql client library, which is compiled with latin1 character set.

In that case, even if you enter valid utf8 values, the client interpretes the values as latin1. Then tell the server 'Hey, these values are encoded in latin1'. When the values are stored in the table, MySQL thinks 'Oh, the values passed from the client is latin1 but the table is utf8. I have to convert it!' That's why the values becomes non-utf8.

By executing "set names utf8", it sets the client character set variables to utf8. So the values sent from the client program are stored 'as is' in the table because the client character set and the table's character set is the same.

This is FAQ. I think this behavior and workaround should be documented somewhere in the manual. Or client library compiled with different character sets should be downloadable.

Options: ReplyQuote


Subject
Views
Written By
Posted
68031
September 29, 2005 02:30AM
21555
September 30, 2005 02:54AM
Re: set names 'utf8'
48915
September 30, 2005 11:45AM
15669
October 04, 2005 02:52PM
15655
November 20, 2007 06:04AM
12801
February 14, 2009 09:18AM


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.