/** * HTML methods */ static VALUE rb_eu_escape_html(int argc, VALUE *argv, VALUE self) { VALUE rb_out_buf, str, rb_secure; struct buf *out_buf; int secure = g_html_secure; if (rb_scan_args(argc, argv, "11", &str, &rb_secure) == 2) { if (rb_secure == Qfalse) { secure = 0; } } Check_Type(str, T_STRING); out_buf = bufnew(128); houdini_escape_html(out_buf, (uint8_t *)RSTRING_PTR(str), RSTRING_LEN(str), secure); rb_out_buf = rb_str_new((char *)out_buf->data, out_buf->size); bufrelease(out_buf); #ifdef HAVE_RUBY_ENCODING_H rb_enc_copy(rb_out_buf, str); #endif return rb_out_buf; }