summaryrefslogtreecommitdiff
path: root/spec/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-11-22 22:51:00 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-11-22 22:51:28 +0900
commit82e836dc7d2aa8cf13d7bc6d671f64b26ea12091 (patch)
treeddf7a77ebfa4efe4975ad541c7fd4925b91213ce /spec/ruby
parentd403591b34e204a5937241025c62c877e579fbaf (diff)
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.
Diffstat (limited to 'spec/ruby')
-rw-r--r--spec/ruby/core/string/valid_encoding_spec.rb4
1 files 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