This project is closed and read-only.
Actions
Backport #4018
closedString#<< can result in string that lies about String#valid_encoding?
Backport #4018:
String#<< can result in string that lies about String#valid_encoding?
Status:
Closed
Assignee:
Description
=begin
s1 = "aa".force_encoding("utf-16be")
s2 = "\xFF".force_encoding("utf-16be")
s1.valid_encoding?
s1 << s2
s1.valid_encoding? # => 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
Actions