From: "Iñaki Baz Castillo" Date: 2009-12-03T00:17:08+09:00 Subject: How to use rb_enc_str_new() to create a String with UTF-8 encoding? Hi, when I create a Ruby String from a C extension by using "rb_str_new(s, 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 rb_enc_str_new() function in string.c: VALUE rb_enc_str_new(const char *ptr, long len, rb_encoding *enc) { VALUE str = 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. -- Iñaki Baz Castillo