1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use hex-encoded binaries instead of UTF-8

Which UTF-8 char corresponds to the binary representation is
nonsense for other encodings, and just confusing.
This commit is contained in:
Nobuyoshi Nakada 2020-11-22 22:51:00 +09:00
parent d403591b34
commit 82e836dc7d
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -13,7 +13,7 @@ describe "String#valid_encoding?" do
end
it "returns true for all encodings self is valid in" do
str = "\u{6754}"
str = "\xE6\x9D\x94"
str.force_encoding('BINARY').valid_encoding?.should be_true
str.force_encoding('UTF-8').valid_encoding?.should be_true
str.force_encoding('US-ASCII').valid_encoding?.should be_false
@ -102,7 +102,7 @@ describe "String#valid_encoding?" do
ruby_version_is '3.0' do
it "returns true for IBM720 encoding self is valid in" do
str = "\u{6754}"
str = "\xE6\x9D\x94"
str.force_encoding('IBM720').valid_encoding?.should be_true
str.force_encoding('CP720').valid_encoding?.should be_true
end