def close
            if @done then return end
            unless @_mGotData
                if DEBUG
                    p("no data received!\n")
                end
                return
            end
            @done = true
            
            if @_mInputState == :PureAscii
                @result = {"encoding" =>  "ascii", "confidence" => 1.0}
                return @result
            end

            if @_mInputState == :Highbyte
                proberConfidence = nil
                maxProberConfidence = 0.0
                maxProber = nil
                for prober in @_mCharSetProbers
                    unless prober then next end
                    proberConfidence = prober.get_confidence()
                    if proberConfidence > maxProberConfidence
                        maxProberConfidence = proberConfidence
                        maxProber = prober
                    end
                end
                if maxProber and (maxProberConfidence > MINIMUM_THRESHOLD)
                    @result = {"encoding" => maxProber.get_charset_name(),
                                   "confidence" => maxProber.get_confidence()}
                    return @result
                end
            end #if
            
            if DEBUG
                p("no probers hit minimum threshhold\n")
                for prober in @_mCharSetProbers
                    unless prober then next end
                    p("%s confidence = %s\n" % \
                                     [prober.get_charset_name(), \
                                      prober.get_confidence()])
                end
            end            
        end
def close
            if @done then return end
            unless @_mGotData
                if DEBUG
                    p("no data received!\n")
                end
                return
            end
            @done = true
            
            if @_mInputState == :PureAscii
                @result = {"encoding" =>  "ascii", "confidence" => 1.0}
                return @result
            end

            if @_mInputState == :Highbyte
                proberConfidence = nil
                maxProberConfidence = 0.0
                maxProber = nil
                for prober in @_mCharSetProbers
                    unless prober then next end
                    proberConfidence = prober.get_confidence()
                    if proberConfidence > maxProberConfidence
                        maxProberConfidence = proberConfidence
                        maxProber = prober
                    end
                end
                if maxProber and (maxProberConfidence > MINIMUM_THRESHOLD)
                    @result = {"encoding" => maxProber.get_charset_name(),
                                   "confidence" => maxProber.get_confidence()}
                    return @result
                end
            end #if
            
            if DEBUG
                p("no probers hit minimum threshhold\n")
                for prober in @_mCharSetProbers
                    unless prober then next end
                    p("%s confidence = %s\n" % \
                                     [prober.get_charset_name(), \
                                      prober.get_confidence()])
                end
            end            
        end
feed