Skip to content

Instantly share code, notes, and snippets.

@psy-q
Created July 16, 2012 12:21
Show Gist options
  • Select an option

  • Save psy-q/3122406 to your computer and use it in GitHub Desktop.

Select an option

Save psy-q/3122406 to your computer and use it in GitHub Desktop.
Encoding error in JRuby but not in MRI

Tne following code throws an error on line 171:

https://github.com/psy-q/stizun/blob/master/lib/supplier_util.rb

The error is:

Failure/Error: JetTestHelper.import_from_file(Rails.root + "spec/data/jet_products.utf8.csv")
Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT

The file that gets imported is this:

https://github.com/psy-q/stizun/blob/master/spec/data/jet_products.utf8.csv

Adding encoding configuration to database.yml does not make any difference, this is the current configuration:

test:
    adapter: jdbcmysql
    host: localhost
    encoding: utf8
    database: stizun_test
    username: root
    password:

However, the whole thing does work on irb and in a Rails console, but does NOT work during Rspec tests (!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment