diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-15 11:26:07 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-15 11:26:07 +0000 |
commit | 5300eecfb324f3a29d891b3e229baef631dc6aeb (patch) | |
tree | d5082f25c6b239bcd018156e6fa54dc5f2c798ab /ext/nkf/lib | |
parent | 976b4e5f8bedcd8285578c6da5117b6883ef1c02 (diff) | |
download | ruby-5300eecfb324f3a29d891b3e229baef631dc6aeb.tar.gz |
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@10938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/nkf/lib')
-rw-r--r-- | ext/nkf/lib/kconv.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb index 4ffe8d984e..91553228fe 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 # |