mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
6c6f996d71
commit
03a1e25542
5 changed files with 104 additions and 82 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue