Skip to content

SQLite3::Database#execute_batch fails with non-ASCII characters #524

Closed
@Math2

Description

@Math2

Before v2.0.0, the following used to work:

require 'sqlite3'

db = SQLite3::Database.new ':memory:'

db.execute_batch %{
  CREATE TABLE test(t TEXT);
  INSERT INTO test VALUES ('héhé');
}

But now fails with:

/usr/home/mathieu/.gem/ruby/3.2/gems/sqlite3-2.0.0/lib/sqlite3/statement.rb:31:in `encode': "\xC3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
        from /usr/home/mathieu/.gem/ruby/3.2/gems/sqlite3-2.0.0/lib/sqlite3/statement.rb:31:in `initialize'
        from /usr/home/mathieu/.gem/ruby/3.2/gems/sqlite3-2.0.0/lib/sqlite3/database.rb:166:in `new'
        from /usr/home/mathieu/.gem/ruby/3.2/gems/sqlite3-2.0.0/lib/sqlite3/database.rb:166:in `prepare'
        from /usr/home/mathieu/.gem/ruby/3.2/gems/sqlite3-2.0.0/lib/sqlite3/database.rb:250:in `execute_batch'
        from ./test.rb:5:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions