зеркало из https://github.com/github/ruby.git
* 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:
Родитель
ae9af4d333
Коммит
d1429c3cc6
|
@ -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>
|
Sun Aug 31 14:27:27 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* transcode.c (econv_last_error): new method.
|
* transcode.c (econv_last_error): new method.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "transcode_data.h"
|
#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] }
|
ISO_8859_1_TO_UCS_TBL = (0x80..0xff).map {|c| ["%02X" % c, c] }
|
||||||
CONTROL1_TO_UCS_TBL = (0x80..0x9f).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)
|
assert_kind_of(Encoding::InvalidByteSequence, ec.last_error)
|
||||||
end
|
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
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче