A command in my AppleScript gets a string like this:
ERR-The book Gen cannot be found.
As you can see, there are many signs that are not properly displayed here.
When I set the clipboard to the string and convert it into unicode character values, it shows as this:
It does not work. It cannot detect either "\u0000" or "\x00".
The issue with Keyboard Maestro is: if I pass the result to KM variables, the string will be cut off and I get only the first letter E. If I set the clipboard to the string, I can get the entire string, including those "\x00".
The result in Script Debugger:
(On the left, all results show only "E").
on decodeCharacterHexString(theCharacters)
copy theCharacters to {theIdentifyingCharacter, theMultiplierCharacter, theRemainderCharacter}
set theHexList to "123456789ABCDEF"
if theMultiplierCharacter is in "ABCDEF" then
set theMultiplierAmount to offset of theMultiplierCharacter in theHexList
else
set theMultiplierAmount to theMultiplierCharacter as integer
end if
if theRemainderCharacter is in "ABCDEF" then
set theRemainderAmount to offset of theRemainderCharacter in theHexList
else
set theRemainderAmount to theRemainderCharacter as integer
end if
set theASCIINumber to (theMultiplierAmount * 16) + theRemainderAmount
return (ASCII character theASCIINumber)
end decodeCharacterHexString
I can then call it:
if myStr contains (decodeCharacterHexString("%00")) then
But you should really ask on the Script Debugger forum to get up-to-date information. AppleScript has come a long way since the handler you found was written.