mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/stringio/stringio.c (strio_set_encoding): defined for
StringIO#set_encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5a7c5d34fb
commit
fd898245cb
2 changed files with 23 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sun Oct 5 17:39:21 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/stringio/stringio.c (strio_set_encoding): defined for
|
||||||
|
StringIO#set_encoding.
|
||||||
|
|
||||||
Sun Oct 5 11:24:42 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
Sun Oct 5 11:24:42 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c: come back definition of environ.
|
* eval.c: come back definition of environ.
|
||||||
|
|
|
@ -1244,6 +1244,23 @@ strio_internal_encoding(VALUE self)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* call-seq:
|
||||||
|
* strio.set_encoding(ext_enc) => strio
|
||||||
|
*
|
||||||
|
* Tagged with the encoding specified.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
strio_set_encoding(VALUE self, VALUE ext_enc)
|
||||||
|
{
|
||||||
|
rb_encoding* enc;
|
||||||
|
VALUE str = StringIO(self)->string;
|
||||||
|
enc = rb_to_encoding(ext_enc);
|
||||||
|
rb_enc_associate(str, enc);
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pseudo I/O on String object.
|
* Pseudo I/O on String object.
|
||||||
*/
|
*/
|
||||||
|
@ -1322,4 +1339,5 @@ Init_stringio()
|
||||||
|
|
||||||
rb_define_method(StringIO, "external_encoding", strio_external_encoding, 0);
|
rb_define_method(StringIO, "external_encoding", strio_external_encoding, 0);
|
||||||
rb_define_method(StringIO, "internal_encoding", strio_internal_encoding, 0);
|
rb_define_method(StringIO, "internal_encoding", strio_internal_encoding, 0);
|
||||||
|
rb_define_method(StringIO, "set_encoding", strio_set_encoding, 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue