Actions
Bug #22451
openCoderange may be set incorrectly when concatenating a string into itself
Bug #22451:
Coderange may be set incorrectly when concatenating a string into itself
Description
s = "\x81\x30".force_encoding("GB18030")
#=> "\x810"
s.valid_encoding? # This is invalid
#=> false
(s + s).valid_encoding? # However it becomes valid when repeated
#=> true
(s << s).valid_encoding? # But concat assumed the coderange would not change
#=> false
s.b.force_encoding(s.encoding).valid_encoding? # Same bytes, different answer
#=> true
No data to display
Actions