Backport #4018

String#<< can result in string that lies about String#valid_encoding?

Added by Timothy Elliott over 3 years ago. Updated over 1 year ago.

[ruby-core:33027]
Status:Closed
Priority:Normal
Assignee:Yuki Sonoda

Description

=begin
s1 = "aa".forceencoding("utf-16be")
s2 = "\xFF".force
encoding("utf-16be")
s1.valid_encoding?
s1 << s2

s1.validencoding? # => true
s1.length
s1.valid
encoding? # => false

This issue only happens with UTF-16BE/LE and UTF-32BE/LE. It also only happens if you call String#valid_encoding? before concat with the second string.
=end

History

#1 Updated by Nobuyoshi Nakada over 3 years ago

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

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

=end

#2 Updated by Nobuyoshi Nakada over 3 years ago

  • Category set to M17N
  • Status changed from Closed to Assigned
  • Assignee set to Yuki Sonoda

=begin

=end

#3 Updated by Yuki Sonoda over 3 years ago

  • Status changed from Assigned to Closed

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

=end

Also available in: Atom PDF