ruby-changes:5333
From: nobu <ko1@a...>
Date: Thu, 5 Jun 2008 14:04:05 +0900 (JST)
Subject: [ruby-changes:5333] Ruby:r16834 (trunk): * ext/iconv/iconv.c (iconv_create): find encoding without options.
nobu 2008-06-05 14:03:46 +0900 (Thu, 05 Jun 2008)
New Revision: 16834
Modified files:
trunk/ChangeLog
trunk/ext/iconv/iconv.c
Log:
* ext/iconv/iconv.c (iconv_create): find encoding without options.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/iconv/iconv.c?r1=16834&r2=16833&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16834&r2=16833&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16833)
+++ ChangeLog (revision 16834)
@@ -1,3 +1,7 @@
+Thu Jun 5 14:03:44 2008 Nobuyoshi Nakada <nobu@r...>
+
+ * ext/iconv/iconv.c (iconv_create): find encoding without options.
+
Thu Jun 5 07:48:32 2008 Koichi Sasada <ko1@a...>
* string.c (hash): should be "static".
Index: ext/iconv/iconv.c
===================================================================
--- ext/iconv/iconv.c (revision 16833)
+++ ext/iconv/iconv.c (revision 16834)
@@ -158,7 +158,13 @@
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) {
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/