I have some code that attempts to create a valid xmp sidecar file. These files are used to store metadata about images and other media files. A xmp file is a form of xml so is mostly text. However there is an exception in the first line which includes three high value characters.
The three characters are between the two single quotes following begin= . This header is common to all xmp files so my code stores the header in a variable. I have confirmed that the three characters are in the stream of bytes and they are EF BB BF. My code uses the URL command to write the final file and this strips the characters replacing them with a question mark.<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
Code: Select all
put tXMPhead & cr & tXMPKeywords & tXMPTail into tXMPData
put tXMPdata into URL ("binfile:" & pRawFileDetailsA[tKey]["XMPfilePath"])
I have also tried the following code :
Code: Select all
put pRawFileDetailsA[tKey]["XMPfilePath"] into tFilePath
Open file tFilePath for binary write
write tXMPdata to file tFilePath
close file tFilePath
The results of the Livecode file operations: Hex values:
The screen shots below show portions of the variable that is being saved into a file. They are taken from a hex editor. I placed a break point in my code and copied the contents of the variable into a text file and then opened the text file in the hex editor.
best wishes
Simon