I
Iñaki Baz Castillo
Hi, when I create a Ruby String from a C extension by using "rb_str_new(s,=
=20
len)" I get a String with US-ASCII encoding.
I don't want to call later String#force_encoding"UTF-8") but instead use =
the=20
rb_enc_str_new() function in string.c:
VALUE
rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
{
VALUE str =3D rb_str_new(ptr, len);
rb_enc_associate(str, enc);
return str;
}
But I have no idea on how to set 'enc' parameter to be "UTF-8".
How should I fill the third 'enc' argument?
Thanks a lot.
=2D-=20
I=C3=B1aki Baz Castillo <[email protected]>
=20
len)" I get a String with US-ASCII encoding.
I don't want to call later String#force_encoding"UTF-8") but instead use =
the=20
rb_enc_str_new() function in string.c:
VALUE
rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
{
VALUE str =3D rb_str_new(ptr, len);
rb_enc_associate(str, enc);
return str;
}
But I have no idea on how to set 'enc' parameter to be "UTF-8".
How should I fill the third 'enc' argument?
Thanks a lot.
=2D-=20
I=C3=B1aki Baz Castillo <[email protected]>