Actions
Bug #20466
openInterpolated regular expressions have different encoding than interpolated strings
Description
When the encoding is set to US-ASCII, interpolated strings can have different encoding than interpolated regular expressions. I think they should have the same encoding:
# encoding: US-ASCII
t0 = '\\xc1'
t1 = "#{t0}"
re = /#{t0}/
p [t0.encoding, t1.encoding, re.encoding]
Output is:
$ ./miniruby -v test.rb
ruby 3.4.0dev (2024-05-02T15:27:18Z master 7c0cf71049) [arm64-darwin23]
[#<Encoding:US-ASCII>, #<Encoding:US-ASCII>, #<Encoding:BINARY (ASCII-8BIT)>]
Updated by Eregon (Benoit Daloze) 6 months ago
- Related to Misc #20407: Question about applying encoding modifier to an interpolated Regexp added
Actions
Like0
Like0