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

ruby-changes:7463

From: akr <ko1@a...>
Date: Sun, 31 Aug 2008 16:37:36 +0900 (JST)
Subject: [ruby-changes:7463] Ruby:r18982 (trunk): * enc/trans/single_byte.trans (us_ascii_map): don't define 8bit bytes.

akr	2008-08-31 16:37:10 +0900 (Sun, 31 Aug 2008)

  New Revision: 18982

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

  Log:
    * enc/trans/single_byte.trans (us_ascii_map): don't define 8bit bytes.

  Modified files:
    trunk/ChangeLog
    trunk/enc/trans/single_byte.trans
    trunk/test/ruby/test_econv.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18981)
+++ ChangeLog	(revision 18982)
@@ -1,3 +1,7 @@
+Sun Aug 31 16:34:41 2008  Tanaka Akira  <akr@f...>
+
+	* enc/trans/single_byte.trans (us_ascii_map): don't define 8bit bytes.
+
 Sun Aug 31 14:27:27 2008  Tanaka Akira  <akr@f...>
 
 	* transcode.c (econv_last_error): new method.
Index: enc/trans/single_byte.trans
===================================================================
--- enc/trans/single_byte.trans	(revision 18981)
+++ enc/trans/single_byte.trans	(revision 18982)
@@ -1,7 +1,7 @@
 #include "transcode_data.h"
 
 <%
-  us_ascii_map = [["{00-7f}", :nomap], ["{80-ff}", :undef]]
+  us_ascii_map = [["{00-7f}", :nomap]]
 
   ISO_8859_1_TO_UCS_TBL = (0x80..0xff).map {|c| ["%02X" % c, c] }
   CONTROL1_TO_UCS_TBL = (0x80..0x9f).map {|c| ["%02X" % c, c] }
Index: test/ruby/test_econv.rb
===================================================================
--- test/ruby/test_econv.rb	(revision 18981)
+++ test/ruby/test_econv.rb	(revision 18982)
@@ -613,4 +613,19 @@
     assert_kind_of(Encoding::InvalidByteSequence, ec.last_error)
   end
 
+  def test_us_ascii
+    ec = Encoding::Converter.new("UTF-8", "US-ASCII")
+    ec.primitive_convert(src="\u{3042}", dst="")
+    err = ec.last_error
+    assert_kind_of(Encoding::ConversionUndefined, err)
+    assert_equal("\u{3042}", err.error_char)
+  end
+
+  def test_88591
+    ec = Encoding::Converter.new("UTF-8", "ISO-8859-1")
+    ec.primitive_convert(src="\u{3042}", dst="")
+    err = ec.last_error
+    assert_kind_of(Encoding::ConversionUndefined, err)
+    assert_equal("\u{3042}", err.error_char)
+  end
 end

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

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