/* * call-seq: * NKF.nkf(opt, str) -> string * * Convert _str_ and return converted result. * Conversion details are specified by _opt_ as String. * * require 'nkf' * output = NKF.nkf("-s", input) * * *Note* * By default, nkf decodes MIME encoded string. * If you want not to decode input, use NKF.nkf with <b>-m0</b> flag. */ static VALUE rb_nkf_kconv(obj, opt, src) VALUE obj, opt, src; { char *opt_ptr, *opt_end; volatile VALUE v; reinit(); StringValue(opt); opt_ptr = RSTRING(opt)->ptr; opt_end = opt_ptr + RSTRING(opt)->len; nkf_split_options(opt_ptr); incsize = INCSIZE; input_ctr = 0; StringValue(src); input = (unsigned char *)RSTRING(src)->ptr; i_len = RSTRING(src)->len; result = rb_str_new(0, i_len*3 + 10); v = result; output_ctr = 0; output = (unsigned char *)RSTRING(result)->ptr; o_len = RSTRING(result)->len; *output = '\0'; if(x0201_f == WISH_TRUE) x0201_f = ((!iso2022jp_f)? TRUE : NO_X0201); kanji_convert(NULL); RSTRING(result)->ptr[output_ctr] = '\0'; RSTRING(result)->len = output_ctr; OBJ_INFECT(result, src); return result; }