summaryrefslogtreecommitdiff
path: root/ext/nkf/lib
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-05 15:19:36 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-05 15:19:36 +0000
commit26f0a39bb33c3bc14f35dca12403cfd3cea089e7 (patch)
tree23d7231c0939965c0921828bf7d1463ba54c10f7 /ext/nkf/lib
parent1980223eaa5562ca3ae409b516c30a630aae3f2f (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@8729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/nkf/lib')
-rw-r--r--ext/nkf/lib/kconv.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb
index 8d57c2a5d2..1e9a7317fb 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