Actions
Bug #20992
open`eval(ascii_encoded_code)` raises EncodingError when multibyte local variable exists
ruby -v:
ruby 3.5.0dev (2024-12-28T09:40:37Z master e4ec2128ae) +YJIT +MN +PRISM [arm64-darwin22]
Description
#coding: utf-8
α=1
eval '1+2'.encode('ascii')
$ ruby file.rb
file.rb:3:in 'Kernel#eval': invalid symbol in encoding US-ASCII :"\xCE\xB1" (EncodingError)
from file.rb:3:in '<main>'
Running the file below with LANG=C ruby file.rb
will make IRB unresponsive
#coding: utf-8
α=1
binding.irb
$ LANG=C ruby file.rb
From: file.rb @ line 3 :
1: #coding: utf-8
2: α=1
=> 3: binding.irb
irb(main):001> 1
<internal:kernel>:168:in 'Kernel#loop': invalid symbol in encoding US-ASCII :"\xCE\xB1" (EncodingError)
from <internal:prelude>:5:in 'Binding#irb'
from file.rb:3:in '<main>'
irb(main):002>
Actions
Like0
Like0Like0Like0