Skip to content

Instantly share code, notes, and snippets.

@macks
Created November 10, 2009 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macks/230744 to your computer and use it in GitHub Desktop.
Save macks/230744 to your computer and use it in GitHub Desktop.
do_sqlite3 always return ASCII-8BIT string object on Ruby 1.9. (datamapper ticket #1120)
# coding: utf-8
# Ruby: 1.9.1p243 (2009-07-16 revision 24175) [i486-linux]
# dm-core: 'next' branch
# data_objects: 'next' branch
require 'dm-core'
class Foo
include DataMapper::Resource
property :id, Serial
property :value, String
end
#DataMapper::Logger.new(STDOUT, :debug)
DataMapper.setup(:default, 'sqlite3::memory:')
DataMapper.auto_migrate!
Foo.create(:value => 'some UTF-8 string: 日本語')
p Foo.first.value.encoding.name
# => "ASCII-8BIT"
# This should be "UTF-8"!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment