def getHeuristicCharEncoding(page):
 key = hash(page)
 retVal = (kb.cache.encoding.get(key) or detect(page)['encoding'])
 kb.cache.encoding[key] = retVal
 if retVal:
  infoMsg = ("heuristics detected web page charset '%s'" % retVal)
  singleTimeLogMessage(infoMsg, logging.INFO, retVal)
 return retVal

def getHeuristicCharEncoding ( page ) : key = hash ( page ) retVal = ( kb . cache . encoding . get ( key ) or detect ( page ) [ 'encoding' ] ) kb . cache . encoding [ key ] = retVal if retVal : infoMsg = ( "heuristics detected web page charset '%s'" % retVal ) singleTimeLogMessage ( infoMsg , logging . INFO , retVal ) return retVal
returns page encoding charset detected by usage of heuristics reference: URL .