I have mysql table which has UTF-8 characters stored in some columns. The table was created with the DEFAULT CHARSET=utf8;
If I manually run the select statement I can see the UTF-8 characters but if I use the golang client and use the DB.Query method then I see that the characters are all garbled !
Also, the insert was done from the golang client as well. How come the insert was fine and the read is making it garbled ? I couldn't see any parameters to set the character set while making the query. What am I missing ?
So when the rows were inserted into the DB, the client charset was latin1. And the golang client by default was using utf8. Inserted all the rows again using utf8 and now the golang utf8 client seems to be reading the characters fine !
For others who come across similar problems:
The following command tells the current configuration
mysql> status
The following command sets the client character set. Run it before insert statements.
mysql> set names utf8