From 82e836dc7d2aa8cf13d7bc6d671f64b26ea12091 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 22 Nov 2020 22:51:00 +0900 Subject: [PATCH] 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. --- spec/ruby/core/string/valid_encoding_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/ruby/core/string/valid_encoding_spec.rb b/spec/ruby/core/string/valid_encoding_spec.rb index 3e820a5c6d..d5bf31710f 100644 --- a/spec/ruby/core/string/valid_encoding_spec.rb +++ b/spec/ruby/core/string/valid_encoding_spec.rb @@ -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