Project

General

Profile

Actions

Bug #20466

open

Interpolated regular expressions have different encoding than interpolated strings

Added by tenderlovemaking (Aaron Patterson) 15 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:117753]

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)>]

Related issues 1 (1 open0 closed)

Related to Ruby master - Misc #20407: Question about applying encoding modifier to an interpolated RegexpOpenActions
Actions #1

Updated by Eregon (Benoit Daloze) 15 days ago

  • Related to Misc #20407: Question about applying encoding modifier to an interpolated Regexp added
Actions

Also available in: Atom PDF

Like0
Like0