Project

General

Profile

Actions

Bug #4081

closed

Inconsistent result of String#inspect in case of '"' and '\\' on UTF-16LE encoded string.

Added by phasis68 (Heesob Park) over 11 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3dev (2010-11-22 trunk 29847) [i386-mswin32_90]
Backport:
[ruby-core:33283]

Description

=begin
irb(main):001:0> a = '"\'.encode('utf-16le')
=> "" \ "
irb(main):002:0> a = '"\^%'.encode('utf-16le')
=> "" \ ^%"
irb(main):003:0> a[0]
=> "" "
irb(main):004:0> a[0].inspect
=> ""\"\x00""
irb(main):005:0> a[1]
=> "\ "
irb(main):006:0> a[1].inspect
=> ""\\\x00""
irb(main):007:0> a[2]
=> "^"
irb(main):008:0> a[2].inspect
=> ""^""
irb(main):009:0> a[3]
=> "%"
irb(main):010:0> a[3].inspect
=> ""%""
=end

Actions #1

Updated by nobu (Nobuyoshi Nakada) over 11 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r29868.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions #2

Updated by phasis68 (Heesob Park) over 11 years ago

=begin
It seems that r29868 is not a complete patch.
r29868 introduced another bug.

C:\work>irb
irb(main):001:0> 'abc"\'.encode('UTF-8')
=> "abc\abc"\abc""

=end

Actions

Also available in: Atom PDF