I'm not sure how this happens, but in the ri cache.ri dump file from CRuby 3.4 (see comments in #9049) there's an Encoding object that has a single encoding ivar. When attempting to read it, the following error results:
ArgumentError: UTF-8is not enc_capable
load at org/jruby/RubyMarshal.java:165
<main> at -e:1
That encoding looks like this in the binary (starting at the Iu: sequence):
...
00224e0 002 214 036 { \0 @ 002 223 036 { \0 : \r e n c
00224f0 o d i n g I u : \r E n c o d i n
0022500 g \n U T F - 8 006 ; 006 F : 025 i n s
0022510 t a n c e _ m e t h o d s { 002 U
...
The second 006 there is a reference to the symbol :E, and is followed by a character F, which combined makes a simple way for Ruby to specify a US-ASCII encoding instance variable. Extracting this to a reproducible example we get:
[] jruby $ jruby -e 'Marshal.load("\004\bIu:\rEncoding\nUTF-8\006:\006EF")'
ArgumentError: UTF-8is not enc_capable
load at org/jruby/RubyMarshal.java:165
<main> at -e:1
[] jruby $ cx ruby-3.4 ruby -e 'p Marshal.load("\004\bIu:\rEncoding\nUTF-8\006:\006EF")'
#<Encoding:UTF-8>
I'm not sure what would cause a dump of an Encoding to have an encoding instance variable, but it seems like this is the case in the cache.ri both for this dump and for my local install of Ruby 3.4.7:
$ ruby -e 'Marshal.load(File.read("/Users/headius/.rubies/ruby-3.4.7/share/ri/3.4.0/system/cache.ri"))'
ArgumentError: UTF-8is not enc_capable
load at org/jruby/RubyMarshal.java:165
<main> at -e:1
I'm not sure how this happens, but in the ri
cache.ridump file from CRuby 3.4 (see comments in #9049) there's an Encoding object that has a single encoding ivar. When attempting to read it, the following error results:That encoding looks like this in the binary (starting at the
Iu:sequence):The second
006there is a reference to the symbol:E, and is followed by a characterF, which combined makes a simple way for Ruby to specify a US-ASCII encoding instance variable. Extracting this to a reproducible example we get:I'm not sure what would cause a dump of an Encoding to have an encoding instance variable, but it seems like this is the case in the
cache.riboth for this dump and for my local install of Ruby 3.4.7: