UTF-8 and MySQL

Hello,

I’m having a hard time extracting UTF-8 chars from Ruby in FreeBSD 9.1.
In my “my.cnf” I have the following config:

[client]
default-character-set=utf8
port = 3306
socket = /tmp/mysql.sock

The MySQL server

[mysqld]
(…)

encoding issues

character-set-server=utf8
collation-server=utf8_general_ci

To connect I use sequel gem, using encoding: ‘utf8’ option. I can browse
the database and clearly see the results in utf8 using Sequel Pro (a GUI
MySQL browser for mac) but when I’m doing my tests

root@atma-vps:/root # cat /home/atma/test.rb
#!/usr/bin/env ruby

encoding: UTF-8

require ‘sequel’

msql = Sequel.connect(‘mysql://atma:toola697@localhost/metrosignage’)

b = msql[:drama_addressbook]
b.each do |entry|
p entry
end

I see only 8-BIT ASCII and of course the unicorn comes out with an
error.

Panagiotis (atmosx) Atmatzidis

email: [email protected]
URL: http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5

Hello,

an additional thing that might be worthy noting, if I use
string.force_encoding(“utf-8”) the chars are displayed correctly. I’d
still like to have the displayed properly without using force_encoding.

Any ideas or thoughts are welcomed. I use ruby19 on FreeBSD 9.1

best regards,

Panagiotis (atmosx) Atmatzidis

email: [email protected]
URL: http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5