iconv(*args)
public
Shorthand for
Iconv.open(to, from) { |cd|
(strs + [nil]).collect { |s| cd.iconv(s) }
}
Parameters
to, from |
see Iconv.new
|
strs |
strings to be converted
|
Exceptions
Exceptions thrown by Iconv.new, Iconv.open and Iconv#iconv.
static VALUE
iconv_s_iconv(int argc, VALUE *argv, VALUE self)
{
struct iconv_env_t arg;
if (argc < 2) /* needs `to' and `from' arguments at least */
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, 2);
arg.argc = argc -= 2;
arg.argv = argv + 2;
arg.append = rb_ary_push;
arg.ret = rb_ary_new2(argc);
arg.cd = iconv_create(argv[0], argv[1], NULL, &arg.toidx);
return rb_ensure(iconv_s_convert, (VALUE)&arg, iconv_free, ICONV2VALUE(arg.cd));
}