[前][次][番号順一覧][スレッド一覧]

ruby-changes:63691

From: Nobuyoshi <ko1@a...>
Date: Sun, 22 Nov 2020 22:52:21 +0900 (JST)
Subject: [ruby-changes:63691] 82e836dc7d (master): Use hex-encoded binaries instead of UTF-8

https://git.ruby-lang.org/ruby.git/commit/?id=82e836dc7d

From 82e836dc7d2aa8cf13d7bc6d671f64b26ea12091 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 22 Nov 2020 22:51:00 +0900
Subject: 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.

diff --git a/spec/ruby/core/string/valid_encoding_spec.rb b/spec/ruby/core/string/valid_encoding_spec.rb
index 3e820a5..d5bf317 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/string/valid_encoding_spec.rb#L13
   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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/string/valid_encoding_spec.rb#L102
 
   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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]