class CharDet::EUCJPDistributionAnalysis
Public Class Methods
new()
click to toggle source
Calls superclass method
CharDet::CharDistributionAnalysis::new
# File lib/rchardet/chardistribution.rb, line 230 def initialize super() @charToFreqOrder = JISCharToFreqOrder @tableSize = JIS_TABLE_SIZE @typicalDistributionRatio = JIS_TYPICAL_DISTRIBUTION_RATIO end
Public Instance Methods
get_order(aStr)
click to toggle source
# File lib/rchardet/chardistribution.rb, line 237 def get_order(aStr) # for euc-JP encoding, we are interested # first byte range: 0xa0 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that if aStr[0, 1] >= "\xA0" bytes = aStr.bytes.to_a return 94 * (bytes[0] - 0xA1) + bytes[1] - 0xa1 else return -1 end end