diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-07-05 15:19:36 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-07-05 15:19:36 +0000 |
commit | 3c6006462131401cdff26bcdf0696b9522159487 (patch) | |
tree | 23d7231c0939965c0921828bf7d1463ba54c10f7 /ext/nkf/lib | |
parent | 37b7780205e562f5a6f8fbb2d773b05e970defdd (diff) | |
download | ruby-3c6006462131401cdff26bcdf0696b9522159487.tar.gz ruby-3c6006462131401cdff26bcdf0696b9522159487.tar.xz ruby-3c6006462131401cdff26bcdf0696b9522159487.zip |
* ext/nkf/nkf-utf8/{nkf.c,utf8tbl.c,config.h}:
imported nkf.c 1.70 (support UTF-8-MAC)
* ext/nkf/lib/kconv.rb: add :utf8mac and :internalunicode
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/nkf/lib')
-rw-r--r-- | ext/nkf/lib/kconv.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb index 8d57c2a5d..1e9a7317f 100644 --- a/ext/nkf/lib/kconv.rb +++ b/ext/nkf/lib/kconv.rb @@ -11,8 +11,6 @@ module Kconv # Public Constants # - VERSION = '1.8' - #Constant of Encoding AUTO = ::NKF::AUTO JIS = ::NKF::JIS @@ -30,7 +28,7 @@ module Kconv # Private Constants # - REVISON = %q$Revison$ + REVISION = %q$Revision$ #Regexp of Encoding RegexpShiftjis = /\A(?: @@ -66,6 +64,7 @@ module Kconv :utf8 => '-w', :utf8bom => '-w8', :utf8n => '-w80', + :utf8mac => '-w --utf8mac-input', :utf16 => '-w16', :utf16be => '-w16B', :utf16ben => '-w16B0', @@ -89,6 +88,7 @@ module Kconv :capinput => '--cap-input', # Convert hex after ':' :urlinput => '--url-input', # decode percent-encoded octets :numcharinput => '--numchar-input' # Convert Unicode Character Reference + :internalunicode => '--internal-unicode' # Use Unicode as internal encoding } CONSTANT_TO_SYMBOL = { @@ -149,7 +149,7 @@ module Kconv module_function :kconv # - # Kconv.conv( str, :to => :"euc-jp", :from => :shift_jis, :opt => [:hiragana,:katakana] ) + # Kconv.conv( str, :to => :"euc-jp", :from => :shift_jis, :opt => [:hiragana, :katakana] ) # def conv(str, *args) option = nil @@ -166,9 +166,9 @@ module Kconv to = symbol_to_option(option[0]) from = symbol_to_option(option[1]).to_s.sub(/(-[jesw])/o){$1.upcase} - opt = option[2..-1].to_a.map{|x|symbol_to_option(x)}.compact.join('') + opt = option[2..-1].to_a.flatten.map{|x|symbol_to_option(x)}.compact.join(' ') - nkf_opt = ('-x -m0 %s %s %s' % [to, from, opt]) + nkf_opt = '-x -m0 %s %s %s' % [to, from, opt] result = ::NKF::nkf( nkf_opt, str) end module_function :conv |