summaryrefslogtreecommitdiffstats
path: root/ext/iconv
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-05 05:03:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-05 05:03:46 +0000
commit959f67b1187f09654472257135a33648192ac052 (patch)
tree22cdf479ee91813263756b2177605e72080a0d66 /ext/iconv
parenta340474a8050d2b9c46f2cb9352b86e75bcd0843 (diff)
downloadruby-959f67b1187f09654472257135a33648192ac052.tar.gz
ruby-959f67b1187f09654472257135a33648192ac052.tar.xz
ruby-959f67b1187f09654472257135a33648192ac052.zip
* ext/iconv/iconv.c (iconv_create): find encoding without options.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/iconv')
-rw-r--r--ext/iconv/iconv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 3aaf08fbd..1f0ab84f0 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) {