From 52b3e3b97f42498c1f30984cb1e174422c235c80 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 20 Oct 2008 07:15:19 +0000 Subject: * string.c (rb_locale_str_new): new function to convert string from locale to internal encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ include/ruby/intern.h | 1 + string.c | 6 ++++++ 3 files changed, 12 insertions(+) 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) { -- cgit v1.2.3