summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-30 07:13:55 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-30 07:13:55 +0000
commitbfab0945123e20061de6094f5b6dcfc017351167 (patch)
tree6c47de54105cf39cd4a005a068afb294ecfb5e89
parent30de361409c1599763d71522d646a686015884f2 (diff)
* ext/tcltklib/tcltklib.c(lib_fromUTF8_core): raise ArgumentError when
the unknown encoding name is given. * ext/tcltklib/tcltklib.c(lib_toUTF8_core): ditto. * ext/tk/lib/tk.rb(Tk::Encoding.encoding_convertfrom): bug fix. * ext/tk/lib/tk.rb(Tk::Encoding.encoding_convertto): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--ext/tcltklib/tcltklib.c14
-rw-r--r--ext/tk/lib/tk.rb11
3 files changed, 32 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d990d5929d..1996a77b681 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Fri Jul 30 16:10:54 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c (lib_fromUTF8_core): raise ArgumentError when
+ the unknown encoding name is given.
+
+ * ext/tcltklib/tcltklib.c (lib_toUTF8_core): ditto.
+
+ * ext/tk/lib/tk.rb (Tk::Encoding.encoding_convertfrom): bug fix.
+
+ * ext/tk/lib/tk.rb (Tk::Encoding.encoding_convertto): ditto.
+
Wed Jul 28 18:59:17 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/cgi.rb (CGI::initialize): remove at_exit code for CGI_PARAMS
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
index adbe151f548..2792e53388b 100644
--- a/ext/tcltklib/tcltklib.c
+++ b/ext/tcltklib/tcltklib.c
@@ -3524,7 +3524,12 @@ lib_toUTF8_core(ip_obj, src, encodename)
StringValue(encodename);
encoding = Tcl_GetEncoding(interp, RSTRING(encodename)->ptr);
if (encoding == (Tcl_Encoding)NULL) {
- rb_warning("unknown encoding name '%s'", RSTRING(encodename)->ptr);
+ /*
+ rb_warning("unknown encoding name '%s'",
+ RSTRING(encodename)->ptr);
+ */
+ rb_raise(rb_eArgError, "unknown encoding name '%s'",
+ RSTRING(encodename)->ptr);
}
}
@@ -3667,8 +3672,13 @@ lib_fromUTF8_core(ip_obj, src, encodename)
encoding = Tcl_GetEncoding(interp, RSTRING(encodename)->ptr);
if (encoding == (Tcl_Encoding)NULL) {
- rb_warning("unknown encoding name '%s'", RSTRING(encodename)->ptr);
+ /*
+ rb_warning("unknown encoding name '%s'",
+ RSTRING(encodename)->ptr);
encodename = Qnil;
+ */
+ rb_raise(rb_eArgError, "unknown encoding name '%s'",
+ RSTRING(encodename)->ptr);
}
}
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index af9c63f72a7..e91ba92df1c 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -1943,12 +1943,19 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
tk_call('encoding', 'system', enc)
end
- def encoding_convertfrom(str, enc=None)
+ def encoding_convertfrom(str, enc=nil)
+ # str must be a Tcl's internal string expression in enc.
+ # the return value is a UTF-8 string.
+ enc = encoding_system unless enc
TkCore::INTERP.__invoke('encoding', 'convertfrom', enc, str)
end
alias encoding_convert_from encoding_convertfrom
- def encoding_convertto(str, enc=None)
+ def encoding_convertto(str, enc=nil)
+ # str must be a UTF-8 string.
+ # The return value is a Tcl's internal string expression in enc.
+ # To get an usual enc string, use Tk.fromUTF8(ret_val, enc).
+ enc = encoding_system unless enc
TkCore::INTERP.__invoke('encoding', 'convertto', enc, str)
end
alias encoding_convert_to encoding_convertto