diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-05 05:03:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-05 05:03:46 +0000 |
commit | 5d75d9bf3d3476a92d54d63b5080a59e615fdd9b (patch) | |
tree | 22cdf479ee91813263756b2177605e72080a0d66 | |
parent | b35b33c7516d398e9e93e3e8309b9e5bb29a5267 (diff) | |
download | ruby-5d75d9bf3d3476a92d54d63b5080a59e615fdd9b.tar.gz |
* ext/iconv/iconv.c (iconv_create): find encoding without options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ext/iconv/iconv.c | 8 |
2 files changed, 11 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Thu Jun 5 14:03:44 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ext/iconv/iconv.c (iconv_create): find encoding without options. + Thu Jun 5 07:48:32 2008 Koichi Sasada <ko1@atdot.net> * string.c (hash): should be "static". diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 3aaf08fbd1..1f0ab84f06 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -158,7 +158,13 @@ iconv_create(VALUE to, VALUE from, struct rb_iconv_opt_t *opt, int *idx) const char* fromcode = map_charset(&from); iconv_t cd; - *idx = rb_enc_find_index(tocode); + if ((*idx = rb_enc_find_index(tocode)) < 0) { + const char *slash = strchr(tocode, '/'); + if (slash && slash[1] == '/') { + VALUE tmp = rb_str_new(tocode, slash - tocode); + *idx = rb_enc_find_index(RSTRING_PTR(tmp)); + } + } cd = iconv_open(tocode, fromcode); if (cd == (iconv_t)-1) { |