While attempting to write a hex value to ascii (\xdd\xba\x01\x10), I found that two of the values were being changed (\xdd\xba).
Instead of outputting ݺ or \xdd\xba\x01\x10 The output would be ݺ \x77a\x01\x10
I thought the issue might have been just how it was being assigned to the test var but using pack does the same.
test1 = "\xdd\xba\x01\x10"
test2 = struct.pack("<I", 0x1001badd)
Both result in incorrect hex values being written.
I have temporarily fixed it by adding whitespace and cleaning it up when it writes to a file.
test1 = "\xdd \xba\x01\x10"
cleanup = (test1)
file.write(cleanup.replace(" ", ""))
Python version is 2.7.2 OS is WINXP
and no I can't use Python3 or a newer version of Windows
Does anyone have any idea why this is occurring?
reverse the values, the program is reading d
as a unhexifying string you have to reverse the hex to fix this