summaryrefslogtreecommitdiffstats
path: root/transcode.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-26 02:07:19 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-26 02:07:19 +0000
commit87ef7c5530ae2e65c1485dd6d432f9c8c459f36e (patch)
treea143dfc9f48b6c3934008b0c86509ae053922182 /transcode.c
parent7356dc8e49f1cf8a205e81e987962da9cbe30ea9 (diff)
downloadruby-87ef7c5530ae2e65c1485dd6d432f9c8c459f36e.tar.gz
ruby-87ef7c5530ae2e65c1485dd6d432f9c8c459f36e.tar.xz
ruby-87ef7c5530ae2e65c1485dd6d432f9c8c459f36e.zip
* transcode.c, include/ruby/encoding.c (rb_transcode_convertible):
new function. checking the existance of converter. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/transcode.c b/transcode.c
index 26c57d039..1f0909cd3 100644
--- a/transcode.c
+++ b/transcode.c
@@ -2839,6 +2839,20 @@ econv_s_search_convpath(int argc, VALUE *argv, VALUE klass)
return convpath;
}
+/*
+ * check the existance of converter.
+ * returns the count of the converting paths.
+ * result: >=0:success -1:failure
+ */
+int
+rb_transcode_convertible(const char* from_encoding, const char* to_encoding)
+{
+ VALUE convpath = Qnil;
+ transcode_search_path(from_encoding, to_encoding, search_convpath_i,
+ &convpath);
+ return RTEST(convpath);
+}
+
struct rb_econv_init_by_convpath_t {
rb_econv_t *ec;
int index;