mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* include/ruby/encoding.h (rb_econv_result_t): moved from
transcode_data.h. (rb_econv_elem_t): ditto. (rb_econv_t): ditto. source_encoding and destination_encoding field is added. (rb_econv_open): declared. (rb_econv_convert): ditto. (rb_econv_close): ditto. * transcode.c (rb_econv_open_by_transcoder_entries): initialize source_encoding and destination_encoding field as NULL. (rb_econv_open): make it external linkage. (rb_econv_close): ditto. (rb_econv_convert): ditto. renamed from rb_econv_conv. (make_encoding): new function. (econv_init): use make_encoding and store rb_encoding* in rb_econv_t. (econv_source_encoding): new method Encoding::Converter#source_encoding. (econv_destination_encoding): new method Encoding::Converter#destination_encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
87779b507e
commit
c82aee31b4
5 changed files with 135 additions and 58 deletions
|
@ -25,6 +25,12 @@ class TestEncodingConverter < Test::Unit::TestCase
|
|||
assert_kind_of(Encoding::Converter, Encoding::Converter.new(Encoding::UTF_8, Encoding::EUC_JP))
|
||||
end
|
||||
|
||||
def test_get_encoding
|
||||
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
|
||||
assert_equal(Encoding::UTF_8, ec.source_encoding)
|
||||
assert_equal(Encoding::EUC_JP, ec.destination_encoding)
|
||||
end
|
||||
|
||||
def test_output_region
|
||||
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
|
||||
ec.primitive_convert(src="a", dst="b", nil, 1, Encoding::Converter::PARTIAL_INPUT)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue