-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Environment
Provide at least:
-
JRuby version (
jruby -v) and command line (flags, JRUBY_OPTS, etc)
jruby 9.2.6.0 (2.5.3) 2019-02-11 15ba00b OpenJDK 64-Bit Server VM 12+33 on 12+33 +jit [darwin-x86_64] -
Operating system and platform (e.g.
uname -a)
MacBookPro Mojave
Problem:
I'm trying to read and convert the following file in utf8
https://github.com/tmm1/ripper-tags/blob/7f31ab7d9009ea2c566e81901cd344b04e6356e1/test/fixtures/encoding.rb
Here is the ruby code that works fine in cruby
# test_encoding.rb
filename = "test/fixtures/encoding.rb"
str = File.open(filename, "r:utf8") { |f| f.read }
str.encode!('utf-16', :invalid => :replace, :undef => :replace)
On jruby it raises an exception
$ ruby test_encoding.rb
ArgumentError: not fully converted, 23 bytes left
encode! at org/jruby/RubyString.java:6044
<main> at test.rb:3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels