Created
October 26, 2010 19:35
-
-
Save marnen/647612 to your computer and use it in GitHub Desktop.
Errors when inserting UTF-8 characters into MS SQL Server database with TinyTds
This file contains hidden or 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
>> db = TinyTds::Client.new :username => 'USER', :password => 'PASSWORD', :dataserver => 'SERVER', :database => 'DB', :encoding => 'UTF-8' | |
=> #<TinyTds::Client:0x101174a88> | |
>> db.encoding | |
=> nil | |
>> r = db.execute "insert into awards (title) values ('Japanese')" | |
=> #<TinyTds::Result:0x101167810> | |
>> r.each | |
=> [] | |
>> r = db.execute "insert into awards (title) values ('Japanese 日本語です')" | |
=> #<TinyTds::Result:0x101155188> | |
>> r.each | |
=> [] | |
>> r = db.execute "select * from awards where id = 28"=> #<TinyTds::Result:0x10114d258> | |
>> r.each | |
=> [{"label"=>nil, "created_at"=>nil, "title"=>"Japanese ?????", "updated_at"=>nil, "id"=>28, "has_scores"=>false, "description"=>nil, "award_type_id"=>nil}] | |
>> r.first['title'] | |
=> "Japanese ?????" | |
>> $KCODE | |
=> "UTF8" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment