Surrogate Pair Encodings

Follow up to #9. We're going to need to do this right to get emoji working. And no software is production ready without :hankey: :wink: 

/cc @judofyr @svaarala @brianmario @aroben

I'm working on a pure-C version. Still struggling a bit, but I think it
will be done this weekend.
On tor. 11. des. 2014 at 22.19 Joshua Peek <notifications@github.com> wrote:

> In ext/duktape/duktape_ext.c
> <https://github.com/judofyr/duktape.rb/pull/11#discussion-diff-21710415>:
>
> > @@ -173,7 +181,12 @@ static void ctx_push_ruby_object(duk_context *ctx, VALUE obj)
> >        return;
> >
> >      case T_STRING:
> > -      str = rb_str_conv_enc(obj, rb_enc_get(obj), rb_utf8_encoding());
> > +      str = rb_funcall(
> > +        rb_funcall(
> > +          rb_str_conv_enc(obj, rb_enc_get(obj), rb_enc_find("UTF-16LE")),
> > +          rb_intern("unpack"), 1, rb_str_new2("S*")),
> > +        rb_intern("pack"), 1, rb_str_new2("U*"));
>
> Hrm, no functions from https://github.com/ruby/ruby/blob/trunk/pack.c are
> exported. This works, but it'd be nice if the transcoding process didn't
> have to create all these extra intermediate ruby objects.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/judofyr/duktape.rb/pull/11/files#r21710415>.
>