Created
November 11, 2012 14:30
-
-
Save tbeauvais/4055040 to your computer and use it in GitHub Desktop.
JRuby incompatible character encodings: UTF-8 and ASCII-8BIT
This file contains 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
# Failure case using mysql jdbc adapter | |
$ rails new blog -d mysql | |
$ cd blog | |
$ rake db:create | |
$ rails c | |
Loading development environment (Rails 3.2.8) | |
jruby-1.7.0 :001 > class Foo < ActiveRecord::Base | |
jruby-1.7.0 :002?> end | |
=> nil | |
jruby-1.7.0 :003 > a = ["ÅÆ", "\"ÅÆ"] | |
=> ["ÅÆ", "\"ÅÆ"] | |
jruby-1.7.0 :004 > "(foo = ? bar = ?)".gsub('?') {Foo.connection.quote(a.shift)} | |
(4.0ms) SET SQL_AUTO_IS_NULL=0 | |
Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT | |
from org/jruby/RubyString.java:3014:in `gsub' | |
from (irb):4:in `evaluate' | |
from org/jruby/RubyKernel.java:1065:in `eval' | |
from org/jruby/RubyKernel.java:1390:in `loop' | |
from org/jruby/RubyKernel.java:1173:in `catch' | |
from org/jruby/RubyKernel.java:1173:in `catch' | |
from /Users/tbeauvais/.rvm/gems/jruby-1.7.0/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start' | |
from /Users/tbeauvais/.rvm/gems/jruby-1.7.0/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start' | |
from /Users/tbeauvais/.rvm/gems/jruby-1.7.0/gems/railties-3.2.8/lib/rails/commands.rb:41:in `(root)' | |
from org/jruby/RubyKernel.java:1019:in `require' | |
from script/rails:6:in `(root)' | |
jruby-1.7.0 :005 > RUBY_DESCRIPTION | |
=> "jruby 1.7.0 (1.9.3p203) 2012-10-22 ff1ebbe on Java HotSpot(TM) 64-Bit Server VM 1.6.0_37-b06-434-11M3909 [darwin-x86_64]" | |
jruby-1.7.0 :006 > |
This file contains 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
# Success case using postgres jdbc adapter | |
$ rails new blog -d postgresql | |
$ cd blog | |
Note - may need to edit database.yml for correct db user | |
$ rake db:create | |
$ rails c | |
Loading development environment (Rails 3.2.8) | |
jruby-1.7.0 :001 > class Foo < ActiveRecord::Base | |
jruby-1.7.0 :002?> end | |
=> nil | |
jruby-1.7.0 :003 > a = ["ÅÆ", "\"ÅÆ"] | |
=> ["ÅÆ", "\"ÅÆ"] | |
jruby-1.7.0 :004 > "(foo = ? bar = ?)".gsub('?') {Foo.connection.quote(a.shift)} | |
=> "(foo = 'ÅÆ' bar = '\"ÅÆ')" | |
jruby-1.7.0 :005 > RUBY_DESCRIPTION | |
=> "jruby 1.7.0 (1.9.3p203) 2012-10-22 ff1ebbe on Java HotSpot(TM) 64-Bit Server VM 1.6.0_37-b06-434-11M3909 [darwin-x86_64]" | |
jruby-1.7.0 :006 > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment