summaryrefslogtreecommitdiffstats
path: root/ext/tk/lib
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
commit9bbcaf38dcb427890fd0a9d8e109f65ceff9a5cd (patch)
tree6c47de54105cf39cd4a005a068afb294ecfb5e89 /ext/tk/lib
parent16238893472185b80753b3e48168b19946a9d8db (diff)
downloadruby-9bbcaf38dcb427890fd0a9d8e109f65ceff9a5cd.tar.gz
ruby-9bbcaf38dcb427890fd0a9d8e109f65ceff9a5cd.tar.xz
ruby-9bbcaf38dcb427890fd0a9d8e109f65ceff9a5cd.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@6721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib')
-rw-r--r--ext/tk/lib/tk.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index af9c63f72..e91ba92df 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