Project

General

Profile

Actions

Bug #22519

closed

Incompatibility between parse.y and Prism in the encoding of interpolated strings

Bug #22519: Incompatibility between parse.y and Prism in the encoding of interpolated strings

Added by mame (Yusuke Endoh) 1 day ago. Updated about 17 hours ago.

Status:
Closed
Assignee:
Target version:
-
[ruby-core:127374]

Description

There seems to be an incompatibility between parse.y and Prism in the encoding of interpolated strings.

# in a script file
x = 1
p "#{x}#{x}".encoding  # parse.y: #<Encoding:UTF-8>  prism: #<Encoding:US-ASCII>

a = "abc".force_encoding("US-ASCII")
b = "".encode("UTF-16LE")
s = "#{a}#{b}"
p s.encoding           # parse.y: #<Encoding:UTF-8>  prism: #<Encoding:UTF-16LE>
p s                    # parse.y: "abc"              prism: "\u6261\x63"

@naruse (Yui NARUSE) says the behavior of parse.y is correct. This is probably a bug in the Prism compiler, but I have not looked into it in detail.

With -e, the result of parse.y seems to depend on the locale encoding (the LANG environment variable). I have not looked into the details of this either.

Actions

Also available in: PDF Atom