This input results in xmp: parsing xml failed: XML syntax error on line 1: invalid UTF-8 within d.Decode() when it calls the stdlib xml.Decoder.Decode().
Here's are the actual file bytes starting at the same offset as the snippet above. But you'll notice that after the ??? things seem to diverge. I'm not sure what is wrong here, I don't really know enough about encodings:
The "invalid UTF-8" is apparently at the sequence of 6A 6A 6A on the first line there. Here's a screenshot of the file in my hex viewer:
In the hex viewer, it shows "j j j G F" for those bytes.
ExifTool and other XMP parsers handle things fine, so I'm sure this is technically valid. It's just that the Go XML parser doesn't like it. Do you know any way to fix it?
Turns out nearly every photo from my phone has XMP data with "invalid UTF-8" in the makernotes.
Here's a snippet as produced by
fmt.Printf("%s", packet)
:This input results in
xmp: parsing xml failed: XML syntax error on line 1: invalid UTF-8
withind.Decode()
when it calls the stdlibxml.Decoder.Decode()
.Here's are the actual file bytes starting at the same offset as the snippet above. But you'll notice that after the ??? things seem to diverge. I'm not sure what is wrong here, I don't really know enough about encodings:
The "invalid UTF-8" is apparently at the sequence of
6A 6A 6A
on the first line there. Here's a screenshot of the file in my hex viewer:In the hex viewer, it shows "j j j G F" for those bytes.
ExifTool and other XMP parsers handle things fine, so I'm sure this is technically valid. It's just that the Go XML parser doesn't like it. Do you know any way to fix it?