From d1429c3cc6405a23b10c317c0ffdac96c9a7e61f Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 31 Aug 2008 07:37:10 +0000 Subject: [PATCH] * enc/trans/single_byte.trans (us_ascii_map): don't define 8bit bytes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ enc/trans/single_byte.trans | 2 +- test/ruby/test_econv.rb | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index eb8acd588d..59f087435c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Aug 31 16:34:41 2008 Tanaka Akira + + * enc/trans/single_byte.trans (us_ascii_map): don't define 8bit bytes. + Sun Aug 31 14:27:27 2008 Tanaka Akira * transcode.c (econv_last_error): new method. diff --git a/enc/trans/single_byte.trans b/enc/trans/single_byte.trans index 8cbf474eb5..8c9565c605 100644 --- a/enc/trans/single_byte.trans +++ b/enc/trans/single_byte.trans @@ -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] } diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb index 917b46c629..a704b05ed0 100644 --- a/test/ruby/test_econv.rb +++ b/test/ruby/test_econv.rb @@ -613,4 +613,19 @@ class TestEncodingConverter < Test::Unit::TestCase 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