summaryrefslogtreecommitdiffstats
path: root/ext/nkf/lib
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-15 11:26:07 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-15 11:26:07 +0000
commit5312c444862031e7c1f88ad278d8a185f7c4b0b0 (patch)
treed5082f25c6b239bcd018156e6fa54dc5f2c798ab /ext/nkf/lib
parent91365c5fc14c400cedfacf73116249d49739d1b1 (diff)
downloadruby-5312c444862031e7c1f88ad278d8a185f7c4b0b0.tar.gz
ruby-5312c444862031e7c1f88ad278d8a185f7c4b0b0.tar.xz
ruby-5312c444862031e7c1f88ad278d8a185f7c4b0b0.zip
* ext/nkf/nkf-8/nkf.c: imported nkf 2.0.8 rev.110.
* Fix: check_bom cuts \xfe\xff\xXX\xXX of UTF-32. * Add support --ic=UTF-32. * Fix: can't guess UTF-16 and UTF-32. * Fix: can't decode beyond BMP of UTF-16LE. * ext/nkf/nkf.c (guess): Support UTF-32. * ext/nkf/lib/kconv.rb (kconv): Support UTF-32. * ext/nkf/lib/kconv.rb (to_utf32): new method. * ext/nkf/lib/kconv.rb (to_utf32): new method. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/nkf/lib')
-rw-r--r--ext/nkf/lib/kconv.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb
index 4ffe8d984..91553228f 100644
--- a/ext/nkf/lib/kconv.rb
+++ b/ext/nkf/lib/kconv.rb
@@ -105,6 +105,8 @@ module Kconv
opt << 'W'
when ::NKF::UTF16
opt << 'W16'
+ when ::NKF::UTF32
+ opt << 'W32'
end
case out_code
@@ -118,6 +120,8 @@ module Kconv
opt << 'w'
when ::NKF::UTF16
opt << 'w16'
+ when ::NKF::UTF32
+ opt << 'w32'
when ::NKF::NOCONV
return str
end
@@ -202,6 +206,20 @@ module Kconv
end
module_function :toutf16
+ # call-seq:
+ # Kconv.toutf32(str) -> string
+ #
+ # Convert <code>str</code> to UTF-32
+ #
+ # *Note*
+ # This method decode MIME encoded string and
+ # convert halfwidth katakana to fullwidth katakana.
+ # If you don't want it, use NKF.nkf('-w32xm0', str).
+ def toutf32(str)
+ ::NKF::nkf('-w32m', str)
+ end
+ module_function :toutf32
+
#
# guess
#
@@ -337,6 +355,17 @@ class String
# If you don't want it, use NKF.nkf('-w16xm0', str).
def toutf16; Kconv.toutf16(self) end
+ # call-seq:
+ # String#toutf32 -> string
+ #
+ # Convert <code>self</code> to UTF-32
+ #
+ # *Note*
+ # This method decode MIME encoded string and
+ # convert halfwidth katakana to fullwidth katakana.
+ # If you don't want it, use NKF.nkf('-w32xm0', str).
+ def toutf32; Kconv.toutf32(self) end
+
#
# is Encoding
#