diff --git a/ChangeLog b/ChangeLog index e07dbeab05..4f0f2e646c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Oct 20 15:42:02 2008 Yukihiro Matsumoto + + * string.c (rb_locale_str_new): new function to convert string + from locale to internal encoding. + Mon Oct 20 09:47:13 2008 Tanaka Akira * test/runner.rb: search srcdir/test/arg at first to find test/ruby diff --git a/include/ruby/intern.h b/include/ruby/intern.h index 8e38217aac..6472ee8ced 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -547,6 +547,7 @@ VALUE rb_tainted_str_new_cstr(const char*); VALUE rb_tainted_str_new(const char*, long); VALUE rb_tainted_str_new2(const char*); VALUE rb_external_str_new(const char*, long); +VALUE rb_locale_str_new(const char*, long); VALUE rb_str_buf_new(long); VALUE rb_str_buf_new_cstr(const char*); VALUE rb_str_buf_new2(const char*); diff --git a/string.c b/string.c index 2b126934c1..054a1eb72b 100644 --- a/string.c +++ b/string.c @@ -526,6 +526,12 @@ rb_external_str_new(const char *ptr, long len) return rb_external_str_new_with_enc(ptr, len, rb_default_external_encoding()); } +VALUE +rb_locale_str_new(const char *ptr, long len) +{ + return rb_external_str_new_with_enc(ptr, len, rb_locale_encoding()); +} + static VALUE str_replace_shared(VALUE str2, VALUE str) {