Permalink
Browse files

Clarify what happens if both strings are 7-bit but have different enc…

…odings
  • Loading branch information...
1 parent bff5bf7 commit 7c821c7188cc38b323c602b51af74687e4e5d7c7 @candlerb committed Aug 6, 2009
Showing with 8 additions and 0 deletions.
  1. +8 −0 string19.rb
View
@@ -576,6 +576,14 @@ def test_string19
is [Encoding::UTF_8, Encoding::ISO_8859_1, Encoding::UTF_8],
[a.encoding, b.encoding, Encoding.compatible?(a,b)]
+# If *both* are strings containing only 7-bit ASCII characters, then the
+# result has the encoding of the first.
+
+ a = "hello".force_encoding "ISO-8859-1"
+ b = "world"
+ is Encoding::ISO_8859_1,
+ Encoding.compatible?(a,b)
+
# REFERENCE: rb_enc_compatible() in encoding.c
############# 6. STRING CONCATENATION #############

0 comments on commit 7c821c7

Please sign in to comment.