summaryrefslogtreecommitdiff
path: root/ext/nkf/lib
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-23 09:37:51 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-23 09:37:51 +0000
commit03a1e25542345e6e4b40864a27d62d11df700047 (patch)
treef5f0464ce68837cdef32a59bd7c28e61eceebd09 /ext/nkf/lib
parent6c6f996d71d45a16adc50e768034dbb3971a2586 (diff)
* ext/nkf/nkf.c (rb_nkf_enc_get): use rb_define_dummy_encoding.
* ext/nkf/nkf.c (Init_nkf): use rb_nkf_enc_get("ASCII"). * ext/nkf/nkf-utf8/nkf.c: Update 1.161. * ext/nkf/nkf-utf9/config.h: default output encoding is now UTF-8. * ext/nkf/lib/kconv.rb (Kconv.kconv): replace Encoding#name by Encoding#to_s. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/nkf/lib')
-rw-r--r--ext/nkf/lib/kconv.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb
index f67f19a860..2f22e32aad 100644
--- a/ext/nkf/lib/kconv.rb
+++ b/ext/nkf/lib/kconv.rb
@@ -87,8 +87,8 @@ module Kconv
# <code>out_code</code> and <code>in_code</code> are given as constants of Kconv.
def kconv(str, to_enc, from_enc=nil)
opt = ''
- opt += ' --ic=' + from_enc.name if from_enc
- opt += ' --oc=' + to_enc.name if to_enc
+ opt += ' --ic=' + from_enc.to_s if from_enc
+ opt += ' --oc=' + to_enc.to_s if to_enc
::NKF::nkf(opt, str)
end
@@ -210,13 +210,8 @@ class String
#
# Convert <code>self</code> to out_code.
# <code>out_code</code> and <code>in_code</code> are given as constants of Kconv.
- #
- # *Note*
- # This method decode MIME encoded string and
- # convert halfwidth katakana to fullwidth katakana.
- # If you don't want to decode them, use NKF.nkf.
def kconv(to_enc, from_enc=nil)
- form_enc = self.encoding.name if !from_enc && self.encoding != Encoding.list[0]
+ form_enc = self.encoding if !from_enc && self.encoding != Encoding.list[0]
Kconv::kconv(self, to_enc, from_enc)
end