Escaping quotes in comment tags

Started by thewessidestory, July 21, 2023, 02:36:50 PM

Previous topic - Next topic

thewessidestory

I am trying to save comments with various quotation marks and newlines in them. I've been using the "-ec" tag to allow c-style strings, but I get a lot of errors indicating incorrect escaping but can't seem to figure out what it's expecting.

exiftool -ec -EXIF:UserComment="บังเอิญมากกกก! นัดเจอ my friend แต่เจอ Mike! \nCan't believe they're here at \"The Forum\" right now!" -overwrite_original file.jpg
Returns: "quote> "

exiftool -ec -EXIF:UserComment='บังเอิญมากกกก! นัดเจอ my friend แต่เจอ Mike! \nCan\'t believe they\'re here at "The Forum" right now!'' -overwrite_original file.jpg
Returns: "Error: File not found - believe
Error: File not found - they're
Error: File not found - here
Error: File not found - at
Error: File not found - The Forum
Error: File not found - right
Error: File not found - now!
    1 image files updated
    7 files weren't updated due to errors"

I've tried a bunch of less conventional methods of escaping as well. What is the correct way of doing this?

Phil Harvey

Quoting is a function of the command shell you are using, but you haven't told us which one that is.

- 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 ($).