* 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
This commit is contained in:
akr 2008-08-31 07:37:10 +00:00
Родитель ae9af4d333
Коммит d1429c3cc6
3 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Sun Aug 31 16:34:41 2008 Tanaka Akira <akr@fsij.org>
* enc/trans/single_byte.trans (us_ascii_map): don't define 8bit bytes.
Sun Aug 31 14:27:27 2008 Tanaka Akira <akr@fsij.org>
* transcode.c (econv_last_error): new method.

Просмотреть файл

@ -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] }

Просмотреть файл

@ -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