Class CharDet::EUCTWDistributionAnalysis
In: lib/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb
Parent: CharDistributionAnalysis

Methods

get_order   new  

Public Class methods

[Source]

# File lib/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb, line 102
    def initialize
      super()
      @_mCharToFreqOrder = EUCTWCharToFreqOrder
      @_mTableSize = EUCTW_TABLE_SIZE
      @_mTypicalDistributionRatio = EUCTW_TYPICAL_DISTRIBUTION_RATIO
    end

Public Instance methods

[Source]

# File lib/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb, line 109
    def get_order(aStr)
      # for euc-TW encoding, we are interested 
      #   first  byte range: 0xc4 -- 0xfe
      #   second byte range: 0xa1 -- 0xfe
      # no validation needed here. State machine has done that
      if aStr[0..0] >= "\xC4"
        return 94 * (aStr[0] - 0xC4) + aStr[1] - 0xA1
      else
        return -1
      end
    end

[Validate]