Getting an UTF-8 encoding related error

Started by calin, June 15, 2021, 11:19:28 AM

Previous topic - Next topic

calin

Hi,

For context: I am calling exiftool from Dart, and on some files when I do:

exiftool -charset exiftool=UTF8 -G -s -a "/Users/me/Pictures/Tests/2012.07 - Test/20120722_175913.jpg"

Dart is complaining about

FormatException: Invalid UTF-8 byte (at offset 2826)


I tried using the -charset switch in order to avoid it but no dice.
I also redirected the output to a file, but Atom seems to have no problem with it and recognizes it as UTF-8.

I did try to read everything though, and it might be the field "UserComment" that contains some weird stuff.

[EXIF]          UserComment                     : .�.;


/context



For this reason I want to either:

- find a way to output valid UTF-8 text (that Dart accepts, maybe Dart has its own quirks, but I don't expect you to give me fixes for Dart or my Dart code :)

or

- ignore the field when I retrieve the exif data for the file (since I'm currently only interested in the date/time and location fields, I could only extract those, but if possible I would prefer to extract the maximum amount of information)


Thank you for your reply.

Phil Harvey

The normal ExifTool output isn't guaranteed to have a known character set.  You must use one of the JSON, CSV or XML output formats (-j, -csv or -X) if you want to guarantee this.

- phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

calin

Can I exclude a single field then ?

I'd rather not have to do the extra leg work of processing JSON (which would still be preferable to CSV or XML :)

Thanks.

calin

I have found somewhere else on the forum the answer:

using

--UserComment

leaves out the comment field and no longer results in an error.