Search code examples
exiftool

exiftool not showing space character when using -t or -T option


I am using the following command to save a tag with a space character:

exiftool -config xmp.config -overwrite_original -PropertyID=' ' /Users/admin/Downloads/Files/09913/1KingWithSofaBed_rm521_1.tif

Using the -X option, I can see that the space character was saved succesfully:

exiftool -X -filename -PropertyID /Users/admin/Downloads/Files/09913/1KingWithSofaBed_rm521_1.tif

<?xml version='1.0' encoding='UTF-8'?>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about='/Users/admin/Downloads/Files/09913/1KingWithSofaBed_rm521_1.tif'
  xmlns:et='http://ns.exiftool.ca/1.0/' et:toolkit='Image::ExifTool 11.84'
  xmlns:System='http://ns.exiftool.ca/File/System/1.0/'
  xmlns:XMP-xmp='http://ns.exiftool.ca/XMP/XMP-xmp/1.0/'>
 <System:FileName>1KingWithSofaBed_rm521_1.tif</System:FileName>
 <XMP-xmp:PropertyID> </XMP-xmp:PropertyID>
</rdf:Description>
</rdf:RDF>

The problem is that -t or -T does not show the space:

exiftool -t -filename -PropertyID /Users/admin/Downloads/Files/09913/1KingWithSofaBed_rm521_1.tif

File Name   1KingWithSofaBed_rm521_1.tif
Property ID 



exiftool -T -filename -PropertyID /Users/admin/Downloads/Files/09913/1KingWithSofaBed_rm521_1.tif

1KingWithSofaBed_rm521_1.tif    

In both cases the space is not present (I have checked the contents with an hex editor) for the PropertyID field.

Is this a limitation of exiftool or it is possible to show it usint -t or -T option?


Solution

  • The answer from Phil Harvey, the author of exiftool

    You can use the (undocumented) -ec option (ExifTool 11.54 or later) to escape control characters using C-style escape sequences and preserve trailing newlines, nulls and newlines, etc

    I tested it out and it seemed to preserve trailing spaces