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

ruby-changes:36053

From: duerst <ko1@a...>
Date: Sat, 25 Oct 2014 20:09:16 +0900 (JST)
Subject: [ruby-changes:36053] duerst:r48134 (trunk): lib/unicode_normalize/normalize.rb: added US_ASCII

duerst	2014-10-25 20:09:08 +0900 (Sat, 25 Oct 2014)

  New Revision: 48134

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48134

  Log:
    lib/unicode_normalize/normalize.rb: added US_ASCII
    as trivially supported encoding (is always normalized,
    and may appear mixed in with UTF-8 or other Unicode
    encodings).

  Modified files:
    trunk/ChangeLog
    trunk/lib/unicode_normalize/normalize.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48133)
+++ ChangeLog	(revision 48134)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Oct 25 20:09:09 2014  Martin Duerst <duerst@i...>
+
+	* lib/unicode_normalize/normalize.rb: added US_ASCII
+	  as trivially supported encoding (is always normalized,
+	  and may appear mixed in with UTF-8 or other Unicode
+	  encodings).
+
 Sat Oct 25 20:01:01 2014  Martin Duerst <duerst@i...>
 
 	* test/test-unicode_normalize.rb: added
Index: lib/unicode_normalize/normalize.rb
===================================================================
--- lib/unicode_normalize/normalize.rb	(revision 48133)
+++ lib/unicode_normalize/normalize.rb	(revision 48134)
@@ -138,6 +138,8 @@ module UnicodeNormalize https://github.com/ruby/ruby/blob/trunk/lib/unicode_normalize/normalize.rb#L138
       else
         raise ArgumentError, "Invalid normalization form #{form}."
       end
+    elsif encoding == Encoding::US_ASCII
+      string
     elsif  UNICODE_ENCODINGS.include? encoding
       normalize(string.encode(Encoding::UTF_8), form).encode(encoding)
     else
@@ -166,6 +168,8 @@ module UnicodeNormalize https://github.com/ruby/ruby/blob/trunk/lib/unicode_normalize/normalize.rb#L168
       else
         raise ArgumentError, "Invalid normalization form #{form}."
       end
+    elsif encoding == Encoding::US_ASCII
+      true
     elsif  UNICODE_ENCODINGS.include? encoding
       normalized? string.encode(Encoding::UTF_8), form
     else

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

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