I have a hex-string made from a unicode string with that function:
def toHex(s):
res = \"\"
for c in s:
res += \"%02X\" % ord(c) #at least 2
When I was working with Unicode in a VB app a while ago the first 1 or 2 digits would be removed if they were a "0". Meaning "&H00A2" would automatically be converted to "&HA2", I just created a small function to check the length of the string and if it was less than 4 chars add the missing 0's. I'm not sure if this is what's happening to you, but I thought I would give bit of information as something to be aware of.