Created
April 19, 2013 15:17
-
-
Save nick1123/5421037 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| s = "hello\xdf".force_encoding("ASCII-8BIT") | |
| s.encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "") |
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)
java -version
1.9.3p374 :001 > s = "hello\xdf".force_encoding("ASCII-8BIT")
=> "hello\xDF"
1.9.3p374 :002 > s.encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "")
=> "hello"
1.9.3p374 :004 > RUBY_PLATFORM
=> "x86_64-darwin11.4.2"
1.9.3p374 :005 > RUBY_VERSION
=> "1.9.3" you can see that it is patch 374.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Encoding::UndefinedConversionError: "\xDF" from ASCII-8BIT to UTF-8
from org/jruby/RubyString.java:7580:in
encode' from (irb):2:inevaluate'from org/jruby/RubyKernel.java:1066:in
eval' from org/jruby/RubyKernel.java:1392:inloop'from org/jruby/RubyKernel.java:1174:in
catch' from org/jruby/RubyKernel.java:1174:incatch'from /Users/spencerroan/.rvm/rubies/jruby-1.7.2/bin/jirb:13:in `(root)'