summaryrefslogtreecommitdiff
path: root/test/ruby/test_io_m17n.rb
AgeCommit message (Collapse)Author
2009-07-11* test/ruby/test_io_m17n.rb (test_strip_bom): added.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06* {ext,lib,test}/**/*.rb: removed trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-28* test/ruby/test_io_m17n.rb (test_getc_invalid3): should set binmode if enc isusa
not compatible with ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-20* io.c (rb_io_extract_modeenc): plain rb/wb should set ASCII-8BITmatz
to the external_encoding. * io.c (rb_file_open_internal): ditto. * io.c (NEED_WRITECONV): no conversion when the external_encoding is ASCII-8BIT. * io.c (do_writeconv): skip ASCII-8BIT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-16add an assertion.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-16* io.c (rb_io_binmode): reset encoding conversion.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-25* transcode.c (rb_eUndefinedConversionError): renamed fromakr
rb_eConversionUndefinedError. (rb_eConverterNotFoundError): renamed from rb_eNoConverterError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-18* transcode.c: add "Error" suffix for Encoding exception classes.matz
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp> in [ruby-dev:36346]. * encoding.c (Init_Encoding): rename EncodingCompatibilityError to Encoding::CompatibilityError. [ruby-dev:36366] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16* test/ruby/test_io_m17n.rb: use __FILE__ instead of /dev/null.akr
[ruby-dev:36327] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12add tests.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12* io.c (validate_enc_binmode): extracted from rb_io_extract_modeenc.akr
(rb_io_extract_modeenc): use validate_enc_binmode. (io_encoding_set): call validate_enc_binmode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-10test modified.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-09* io.c (io_fwrite): raise an error if ASCII incompatible stringakr
written for text mode IO without encoding conversion. (rb_io_extract_modeenc): binmode requirement changed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-08add a test.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-07* include/ruby/encoding.h (ECONV_XML_ATTR_CONTENT_ENCODER): defined.akr
(ECONV_STATEFUL_ENCODER_MASK): defined. (ECONV_XML_ATTR_QUOTE_ENCODER): defined. (ECONV_XML_ATTR_ENCODER): removed. * enc/trans/escape.trans (rb_escape_xml_attr_content): defined. (rb_escape_xml_attr_quote): defined. (rb_escape_xml_attr): removed. * io.c (NEED_WRITECONV): writeconv is required if supplemental converter is used. (make_writeconv): apply stateful encoder in writeconv. * transcode.c: follow the constant change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-06* include/ruby/encoding.h (ECONV_ERROR_HANDLER_MASK): defined.akr
(ECONV_DECODER_MASK): defined. (ECONV_ENCODER_MASK): defined. * io.c (make_writeconv): restrict ecflags for writeconv with ECONV_ERROR_HANDLER_MASK. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05fix a test for previous commit.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05* io.c (rb_io_extract_modeenc): raise an error for ASCII incompatibleakr
encoding without binmode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-04* include/ruby/encoding.h (ECONV_INVALID_IGNORE): removed becauseakr
it tend to cause security problem. If the behaviour is really required, ECONV_INVALID_REPLACE with empty string can be used. For example, CVE-2006-2313, CVE-2008-1036, [ruby-core:15645] (ECONV_UNDEF_IGNORE): ditto. * transcode.c (rb_econv_convert): follow the above change. (econv_opts): ditto. (Init_transcode): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-03add tests.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-03* include/ruby/io.h (rb_io_t): new fields: encs.ecopts andakr
writeconv_pre_ecopts. (MakeOpenFile): initialize them. * include/ruby/encoding.h (rb_str_transcode): take ecopts argument. (rb_econv_flags): removed. (rb_econv_prepare_opts): declared. (rb_econv_open_opts): declared. * io.c (make_writeconv): use rb_econv_open_opts. (make_readconv): ditto. (io_fwrite): follow rb_str_transcode change. (rb_io_extract_modeenc): use rb_econv_prepare_opts. (rb_file_open_generic): initialize encs.ecopts. (rb_file_open_internal): ditto. (rb_io_reopen): ditto. (argf_ecopts): defined. (argf_next_argv): set encs.ecopts. (io_encoding_set): use rb_econv_prepare_opts. (argf_set_encoding): set argf_ecopts. * gc.c (gc_mark_children): mark encs.ecopts and writeconv_pre_ecopts in T_FILE. * transcode.c (transcode_loop): take ecopts argument. use rb_econv_open_opts. (rb_econv_flags): removed. (rb_econv_prepare_opts): defined. (rb_econv_open_opts): defined. (str_transcode0): take ecopts. (str_transcode): use rb_econv_prepare_opts. (rb_str_transcode): take ecopts. (econv_init): accept hash argument. (econv_insert_output): follow rb_str_transcode change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-27add a test.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-26* transcode.c (rb_econv_open): disable newline conversion for ASCIIakr
incompatible encodings. (str_transcode0): don't need disable newline conversion here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-24* io.c (rb_io_init_copy): copy encs.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-24* io.c (rb_io_s_pipe): accept optional hash.akr
(rb_io_set_encoding): ditto. (rb_io_extract_modeenc): use rb_econv_opts to initialize ecopts. (rb_file_open_generic): ditto. (rb_file_open_internal): ditto. (io_encoding_set): new argument: opt. (argf_set_encoding): copy fptr->encs.opts to argf_ecopts. * transcode.c (rb_econv_opts): accept Qnil for initialization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-24* include/ruby/encoding.h (rb_str_transcode): add ecflags argument.akr
* transcode.c (econv_opts): extracted from str_transcode. (str_transcode_enc_args): extracted from str_transcode. (str_transcode0): extracted from str_transcode. (str_transcode): use econv_opts, str_transcode_enc_args, str_transcode0. (rb_str_transcode): call str_transcode0. (econv_primitive_insert_output): give the additional argument for rb_str_transcode. * io.c (make_writeconv): use invalid/undef flags. (io_fwrite): ditto. (rb_scan_open_args): give the additional argument for rb_str_transcode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-23* include/ruby/io.h (FMODE_INVALID_MASK): defined.akr
(FMODE_INVALID_IGNORE): defined. (FMODE_INVALID_REPLACE): defined. (FMODE_UNDEF_MASK): defined. (FMODE_UNDEF_IGNORE): defined. (FMODE_UNDEF_REPLACE): defined. * io.c (sym_invalid): defined. (sym_undef): defined. (sym_ignore): defined. (sym_replace): defined. (make_readconv): specify ECONV_INVALID_* and ECONV_UNDEF_* if FMODE_INVALID_* and FMODE_UNDEF_* is set. (rb_io_extract_modeenc): check {:invalid, :undef} => {:replace, :ignore} for FMODE_INVALID_* and FMODE_UNDEF_*. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-23* io.c (rb_io_extract_modeenc): check :textmode and :binmode in optionakr
hash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-22* include/ruby/io.h (FMODE_TEXTMODE): defined.akr
* include/ruby/encoding.h (rb_econv_t): new field: flags. (rb_econv_binmode): declared. * io.c (io_unread): text mode hack removed. (NEED_NEWLINE_DECODER): defined. (NEED_NEWLINE_ENCODER): defined. (NEED_READCONV): defined. (NEED_WRITECONV): defined. (TEXTMODE_NEWLINE_ENCODER): defined for windows. (make_writeconv): setup converter with TEXTMODE_NEWLINE_ENCODER for text mode. (io_fwrite): use NEED_WRITECONV. character code conversion is disabled if fptr->writeconv_stateless is nil. (make_readconv): setup converter with ECONV_UNIVERSAL_NEWLINE_DECODER for text mode. (read_all): use NEED_READCONV. (appendline): use NEED_READCONV. (rb_io_getline_1): use NEED_READCONV. (io_getc): use NEED_READCONV. (rb_io_ungetc): use NEED_READCONV. (rb_io_binmode): OS-level text mode test removed. call rb_econv_binmode. (rb_io_binmode_m): call rb_io_binmode_m with write_io as well. (rb_io_flags_mode): return mode string including "t". (rb_io_mode_flags): detect "t" for text mode. (rb_sysopen): always specify O_BINARY. * transcode.c (rb_econv_open_by_transcoder_entries): initialize flags. (rb_econv_open): if source and destination encoding is both empty string, open newline converter. last_tc will be NULL in this case. (rb_econv_encoding_to_insert_output): last_tc may be NULL now. (rb_econv_string): ditto. (output_replacement_character): ditto. (transcode_loop): ditto. (econv_init): ditto. (econv_inspect): ditto. (rb_econv_binmode): new function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-21* io.c (rb_io_initialize): accept hash argument.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-21* io.c (io_extract_encoding_option): if internal encoding is notakr
specified, enc is external encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (rb_open_file): encoding in mode string was ignored if perm isakr
specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (rb_io_check_readable): side effect for STDIN removed.akr
(rb_io_external_encoding): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (io_ungetbyte): renamed from io_ungetc.akr
(rb_io_ungetbyte): new method. (rb_io_ungetc): push back into character buffer if enc2 is set. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* include/ruby/io.h (rb_io_t): new fields: writeconv,akr
writeconv_stateless and writeconv_initialized. (MakeOpenFile): initialize them. * include/ruby/encoding.h (rb_econv_stateless_encoding): declared. (rb_econv_string): declared. * io.c (make_writeconv): new function. (io_fwrite): use econv. (make_readconv): fix error message. (finish_writeconv): new function. (fptr_finalize): call finish_writeconv. (clear_writeconv): new function. (clear_codeconv): new function to call both clear_readconv and clear_writeconv. (rb_io_fptr_finalize): call clear_codeconv instead of clear_readconv. (mode_enc): ditto. (io_set_encoding): ditto. (argf_next_argv): ditto. (io_encoding_set): ditto. * gc.c (gc_mark_children): mark writeconv_stateless in T_FILE. * transcode.c (stateless_encoding_i): new function. (rb_econv_stateless_encoding): ditto. (rb_econv_string): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (clear_readconv): extracted from rb_io_fptr_finalize.akr
(mode_enc): call clear_readconv. (io_set_encoding): ditto. (argf_next_argv): ditto. (io_encoding_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (io_shift_crbuf): add strp argument to append into existingakr
string. (read_all): use econv if enc2 is set. (io_getc): follow the io_shift_crbuf change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (io_enc_str_converted): new function.akr
(make_readconv): extracted from io_getc. (more_char): ditto. (appendline): use econv via make_readconv and more_char for code conversion. (prepare_getline_args): don't convert record separator. (rb_io_getline_1): don't use rb_io_getline_fast if enc2 is set. (io_getc): use make_readconv and more_char. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18add tests.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17* io.c (appendline): appendline cannot check character boundary.akr
(rb_io_getline_1): relax limit until character boundary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17* include/ruby/encoding.h (rb_econv_putbackable): declared.akr
(rb_econv_putback): ditto. * transcode.c (rb_econv_putbackable): implemented. (rb_econv_putback): ditto. * io.c (io_getc): put back bytes if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16* include/ruby/io.h (rb_io_t): new fields: readconv, crbuf, crbuf_off,akr
crbuf_len, crbuf_capa. (MakeOpenFile): initialize them. * io.c (io_shift_crbuf): new function. (io_getc): use econv. (rb_io_fptr_finalize): finalize readconv and crbuf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-29* io.c (io_ungetc): raise NotImplementedError when ungetc is calledmame
against dummy encoding IO. * io.c (rb_io_getline_1): ditto when gets with delimiter is called. * io.c (io_getc): ditto when getc is called. * test/ruby/test_io_m17n.rb (test_terminator_stateful_conversion, test_getc_stateful_conversion, test_ungetc_stateful_conversion): these tests should raise NotImplementedError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-13* test/ruby/test_io_m17n.rb: remove a duplicative method.mame
* test/ruby/test_utf16.rb: rename a conflicting method name. * test/ruby/test_array.rb: ditto. * test/ruby/test_file_exhaustive.rb: ditto. * test/ruby/test_hash.rb: ditto. * test/ruby/test_env.rb: ditto. * test/ruby/test_fixnum.rb: ditto. * test/ruby/test_rational.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-29add a test.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25add a test.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-24fix last commit.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-24add a test for [ruby-dev:33264].akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09* io.c (rb_io_binmode): should not alter encoding. [ruby-dev:32918]matz
* io.c (io_read_encoding): need not to return ASCII-8BIT for binary IO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03add a test for getc with stateful conversion.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e