Actions
Bug #5968
closedEncoding.compatible? with binary string
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
Backport:
Description
=begin
According to #5920:
The original meaning of Encoding.compatible?(str1, str2) is the encoding of concatenated string.
In other codes, it is
str = str1.dup.concat str2
str.encoding <- this!
But observe:
a = "a".force_encoding("binary")
b = "b".force_encoding("us-ascii")
a.dup.concat(b).encoding #=> #Encoding:ASCII-8BIT
Encoding.compatible?(a, b) #=> #Encoding:US-ASCII
I believe the latter should return #Encoding:ASCII-8BIT.
=end
Actions
Like0
Like0