(value, raw=False)
return retVal
Returns value decoded from DBMS specific hexadecimal representation

    >>> decodeHexValue('3132332031')
    u'123 1'
Returns value decoded from DBMS specific hexadecimal representation
Returns value decoded from DBMS specific hexadecimal representation
def decodeHexValue(value, raw=False):
    """
    Returns value decoded from DBMS specific hexadecimal representation

    >>> decodeHexValue('3132332031')
    u'123 1'
    """

    retVal = value

    def _(value):
        retVal = value
        if value and isinstance(value, basestring) and len(value) % 2 == 0:
            retVal = hexdecode(retVal)

            if not kb.binaryField and not raw:
                if Backend.isDbms(DBMS.MSSQL) and value.startswith("0x"):
                    try:
                        retVal = retVal.decode("utf-16-le")
                    except UnicodeDecodeError:
                        pass
                elif Backend.isDbms(DBMS.HSQLDB):
                    try:
                        retVal = retVal.decode("utf-16-be")
                    except UnicodeDecodeError:
                        pass
                if not isinstance(retVal, unicode):
                    retVal = getUnicode(retVal, "utf8")

        return retVal

    try:
        retVal = applyFunctionRecursively(value, _)
    except:
        singleTimeWarnMessage("there was a problem decoding value '%s' from expected hexadecimal form" % value)

    return retVal
def decodeHexValue ( value , raw = False ) : retVal = value def _ ( value ) : retVal = value if value and isinstance ( value , basestring ) and len ( value ) % 2 == 0 : retVal = hexdecode ( retVal ) if not kb . binaryField and not raw : if Backend . isDbms ( DBMS . MSSQL ) and value . startswith ( "0x" ) : try : retVal = retVal . decode ( "utf-16-le" ) except UnicodeDecodeError : pass elif Backend . isDbms ( DBMS . HSQLDB ) : try : retVal = retVal . decode ( "utf-16-be" ) except UnicodeDecodeError : pass if not isinstance ( retVal , unicode ) : retVal = getUnicode ( retVal , "utf8" ) return retVal try : retVal = applyFunctionRecursively ( value , _ ) except : singleTimeWarnMessage ( "there was a problem decoding value '%s' from expected hexadecimal form" % value ) return retVal