ziutek / mymysql

MySQL Client API written entirely in Go
Other
735 stars 161 forks source link

Problem with character encoding #57

Open bessey opened 11 years ago

bessey commented 11 years ago

This is almost certainly me making a stupid mistake but I don't know where else to ask!

I am attempting to insert UTF-8 encoded data into a table. If I insert the data directly using the mysql command prompt, it works fine. If I use mymysql, L’ Échafaud becomes L’ Échafaud.

It was my understanding that mymysql uses UTF-8 by default. Just in case I added the explicit db.Register("set names utf8") but that hasn't helped either.

Is there something else I need to do in Go to insert UTF-8 encoded strings?

ziutek commented 11 years ago

Dnia 09.02.2013 o 03:39 Matthew Bessey notifications@github.com Matthew
Bessey notifications@github.com napisał(a):

This is almost certainly me making a stupid mistake but I don't know
where else to ask!

I am attempting to insert UTF-8 encoded data into a table. If I insert
the data directly using the mysql command prompt, it works fine. If I
use mymysql, L’ Échafaud becomes L’ Échafaud.

It was my understanding that mymysql uses UTF-8 by default. Just in case
I added the explicit db.Register("set names utf8") but that hasn't
helped either.

Is there something else I need to do in Go to insert UTF-8 encoded
strings?


Reply to this email directly or view it on GitHub: https://github.com/ziutek/mymysql/issues/57

You only need to use "set names utf8" command. Try it in mysql.

What encoding is used in table? Is it VARCHAR or TEXT field?

Please don't create issue in tracker if you only want ask question.

Michał Derkacz

bessey commented 11 years ago

Hey, apologies for asking in the wrong place, would you rather move this discussion elsewhere? My email is bessey@gmail.com

ex-troll commented 11 years ago

add this to section [mysqld] in my.cnf

character-set-server=utf8
collation-server=utf8_unicode_ci