rbuconv - Pure Ruby Unicode converter (c) 2003 by yoshidam $Id: rbuconv.rb,v 1.3 2003/05/15 15:22:43 yoshidam Exp $
EUC-JP(Hojo Kanji) to UCS (c) 2003 by yoshidam $Id: eucjphojo_ucs.rb,v 1.1.1.1 2003/04/16 14:33:52 yoshidam Exp $
CP932 to UCS (c) 2003 by yoshidam $Id: cp932_ucs.rb,v 1.1.1.1 2003/04/16 14:33:52 yoshidam Exp $
EUC-JP to UCS (c) 2003 by yoshidam $Id: eucjp_ucs.rb,v 1.1.1.1 2003/04/16 14:33:52 yoshidam Exp $
UCS to CP932 (c) 2003 by yoshidam $Id: ucs_cp932.rb,v 1.1.1.1 2003/04/16 14:33:52 yoshidam Exp $
UCS to EUC-JP (c) 2003 by yoshidam $Id: ucs_eucjp.rb,v 1.1.1.1 2003/04/16 14:33:52 yoshidam Exp $
(Not documented)
# File rbuconv.rb, line 440 def eliminate_zwnbsp false end
(Not documented)
# File rbuconv.rb, line 444 def eliminate_zwnbsp=(arg) raise NotImplementedError.new("not implemented") end
(Not documented)
# File rbuconv.rb, line 298 def euctou16(str) ret = euctoucs(str).pack('v*') ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 292 def euctou8(str) ret = euctoucs(str).pack('U*') ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 136 def getEUCJPHojotoUCSMap if !defined?(@@EUCJPHojotoUCSMap) puts "loading..." if $DEBUG require 'uconv/eucjphojo_ucs' end @@EUCJPHojotoUCSMap end
(Not documented)
# File rbuconv.rb, line 456 def replace_invalid true end
(Not documented)
# File rbuconv.rb, line 460 def replace_invalid=(arg) raise NotImplementedError.new("not implemented") end
(Not documented)
# File rbuconv.rb, line 448 def shortest false end
(Not documented)
# File rbuconv.rb, line 452 def shortest=(arg) raise NotImplementedError.new("not implemented") end
(Not documented)
# File rbuconv.rb, line 420 def sjistou16(str) ret = sjistoucs(str).pack('v*') ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 414 def sjistou8(str) ret = sjistoucs(str).pack('U*') ret.taint if str.tainted? ret end
Shift_JIS (CP932)
# File rbuconv.rb, line 319 def sjistoucs(str) i = 0 len = str.length ret = [] map = getCP932toUCSMap while i < len c = str[i] if c <= 0x7f ret << c elsif c >= 0x80 && c <= 0xfc u = REPLACEMENT_CHAR if i+1 < len && str[i+1] >= 0x40 && str[+1] <= 0xfc u = 0 i += 1 hi = c low = str[i] if hi >= 0xe0 pos = (hi - 0xc1)*188 else pos = (hi - 0x81)*188 end if low >= 0x80 pos += low - 0x41 else pos += low - 0x40 end if pos < 11280 pos = pos * 2 u = (map[pos] << 8) | map[pos + 1] end if u == 0 ## unknown SJIS character if respond_to?(:unknown_sjis_handler) u = unknown_sjis_handler([hi, low].pack('cc')) else u = REPLACEMENT_CHAR end end end ret << u elsif c >= 0xa0 && c <= 0xdf u = 0xff00 | (c - 0x40) ret << u else ## invalid character ret << REPLACEMENT_CHAR end i += 1 end ret end
(Not documented)
# File rbuconv.rb, line 100 def u16swap(str) ret = str.unpack('n*').pack('v*') ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 107 def u16swap!(str) str[0..-1] = u16swap(str) end
(Not documented)
# File rbuconv.rb, line 311 def u16toeuc(str) ret = ucstoeuc(combineSurrogatePair(str.unpack('v*'))) ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 433 def u16tosjis(str) ret = ucstosjis(combineSurrogatePair(str.unpack('v*'))) ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 82 def u16tou4(str) ret = combineSurrogatePair(str.unpack('v*')).pack('V*') ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 75 def u16tou8(str) ret = combineSurrogatePair(str.unpack('v*')).pack('U*') ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 112 def u4swap(str) ret = str.unpack('N*').pack('V*') ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 118 def u4swap!(str) str[0..-1] = u4swap(str) end
(Not documented)
# File rbuconv.rb, line 94 def u4tou16(str) ret = divideSurrogatePair(str.unpack('V*')).pack('v*') ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 88 def u4tou8(str) ret = str.unpack('V*').pack('U*') ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 305 def u8toeuc(str) ret = (ucstoeuc(str.unpack('U*')) rescue raise Uconv::Error.new($!)) ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 427 def u8tosjis(str) ret = (ucstosjis(str.unpack('U*')) rescue raise Uconv::Error.new($!)) ret.taint if str.tainted? ret end
(Not documented)
# File rbuconv.rb, line 60 def u8tou16(str) ret = (divideSurrogatePair(str.unpack('U*')).pack('v*') rescue raise Uconv::Error.new($!)) ret.taint if str.tainted? ret end
Disabled; run with $DEBUG to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.