Created
October 13, 2010 19:56
-
-
Save jschwindt/624770 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
juan:~> ruby -v | |
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0] | |
juan:~> rails -v | |
Rails 3.0.0 | |
juan:~> rails new testencoding | |
create | |
create README | |
...... | |
create vendor/plugins | |
create vendor/plugins/.gitkeep | |
juan:~> cd testencoding/ | |
juan:~/testencoding> cat gemfile | |
source 'http://rubygems.org' | |
gem 'rails', '3.0.0' | |
gem 'mysql2' | |
juan:~/testencoding> gem list mysql2 | |
*** LOCAL GEMS *** | |
mysql2 (0.2.4) | |
juan:~/testencoding> rails c | |
Loading development environment (Rails 3.0.0) | |
~> Console extensions: wirble hirb ap rails2 rails3 pm interactive_editor | |
ruby-1.9.2-p0 > c = Mysql2::Client.new(:host => "localhost", :username => "root", :database => 'kedin', :encoding => 'latin1') | |
=> #<Mysql2::Client:0x000001019c8450> | |
ruby-1.9.2-p0 > c.query("set names latin1") | |
=> nil | |
ruby-1.9.2-p0 > c.query("select title from event where id = 84318").first['title'].encoding | |
=> #<Encoding:UTF-8> | |
ruby-1.9.2-p0 > quit | |
juan:~/testencoding> irb | |
~> Console extensions: wirble hirb ap rails2 rails3 pm interactive_editor | |
ruby-1.9.2-p0 > require 'mysql2' | |
=> true | |
ruby-1.9.2-p0 > c = Mysql2::Client.new(:host => "localhost", :username => "root", :database => 'kedin', :encoding => 'latin1') | |
=> #<Mysql2::Client:0x00000100920b48> | |
ruby-1.9.2-p0 > c.query("set names latin1") | |
=> nil | |
ruby-1.9.2-p0 > c.query("select title from event where id = 84318").first['title'].encoding | |
=> #<Encoding:ISO-8859-1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment