rails/rails — Issue #3490: ActiveRecord SQLite adaptor, Ruby 1.92 and UTF-16le
Author: rarepleasures
Created: 2011-11-01 20:37:02+00:00
State: open

The following code generates an error with a sqlite database thats UTF-16le encoded:

require 'rubygems'
require 'sqlite3'
require 'active_record'

db = SQLite3::Database.open "sqlite.db"

p db.encoding

# #

ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => 'sqlite.db')

class Programme < ActiveRecord::Base; end

p ActiveRecord::Base.connection.columns('programmes')

# ArgumentError: invalid byte sequence in UTF-16LE

# method extract_limit in column.rb at line 227
# method initialize in column.rb at line 33
# method new in sqlite_adapter.rb at line 332
# method block in columns in sqlite_adapter.rb at line 332
# method map in sqlite_adapter.rb at line 322
# method columns in sqlite_adapter.rb at line 322
# method

in test.rb at line 17