Issue when simple options were added inside brackets in the name of the stand-al

Started by VlCTOR, December 21, 2017, 08:22:50 AM

Previous topic - Next topic

VlCTOR

Hello, Phill.
I am using Windows 7 x64 with Exiftool 10.69
I am in need for command such as exiftool(-CodedCharacterSet=UTF8).exe
But performing of this command leads to incorrect tag record - the IPTC tag CodedCharacterSet value is written such as "U T F 8" (with unnecessary spaces between the characters).

Phil Harvey

The tag is being written correctly.  Is that ExifToolGUI that you are using to display it?  If so, I don't know why it is seemingly inserting spaces.  The actual value written to the file should be ESC % G (3 bytes, no spaces), but this is converted to the string "UTF8" when extracted by ExifTool.

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

VlCTOR

Oh no.

When I use the command line or ARGFILE, the tag is written correctly (see Ok.jpg).
But when I use inside brackets in the name of the stand-alone executable or use an additional parameter in the program "Geotag", the tag is written incorrectly (see Err.jpg)

Phil Harvey

Post a small JPG file with the CodedCharacterSet as written using the brackets technique and I'll take a look.

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

VlCTOR

Oh, my God.
I'm a little messed. The problem only appears when call ExifTool from the "Geotag" program (http://geotag.sourceforge.net/)
See setting of Geotag (tag with unnecessary spaces inside).

Phil Harvey

Right.  Geotag is writing this incorrectly.

Ah.  I can get ExifTool to write this incorrectly if the -n option is used when writing "UTF8".  But this is an operator error.  If written with -n, the value should be "\x1b$G" (ESC % G).

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

VlCTOR

How can I use it?
I get "\ x 1 b   $  g" or "E S C %   g" in the tag CodedCharacterSet.

Phil Harvey

Quote from: VlCTOR on December 21, 2017, 02:49:47 PM
How can I use it?

We have some language difficulty here.  I don't understand the question.

CodedCharacterSet was written incorrectly.

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

VlCTOR


Phil Harvey

Good question.  I don't know how to generate an ESC character on the Windows command line.

CodedCharacterSet should be written like this on the command line:

exiftool -codedcharacterset=UTF8 FILE

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

VlCTOR

To generate an ESC character on the Windows command line simultaneously press ALT and 27 (decimal character code) on the numpad.
But it doesn't work. We have the same problem:
C:\101MSDCF\origin>exiftool -n -codedcharacterset="←%G" 1.jpg
    1 image files updated
C:\101MSDCF\origin>exiftool -codedcharacterset 1.jpg
Coded Character Set             : < % G
C:\101MSDCF\origin>exiftool -n -codedcharacterset="\x1b$%G" 1.jpg
    1 image files updated
C:\101MSDCF\origin>exiftool -codedcharacterset 1.jpg
Coded Character Set             : \ x 1 b $ % G


Phil Harvey

Nice try.

But I don't know why you are trying to do this.

Use the command I gave earlier to set CodedCharacterSet properly.

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

VlCTOR

Geotagging and geonaming are the first thing I do to manage my photos. To do this I use Geotag program.
Geotag utilizes Exiftool to record user's data in IPTC with UTF8 encoding. It uses hidden and fixed key - m.
The second step is using Exiftool to copy data from IPTC to XMP and also adding key words and other personal data from argfile.
-Codedcharacterset=UTF8 is the first command in argument file.
But despite of that, the data from IPTC copies to XMP incorrectly.
This happens because codedcharacterset=UTF8 doesn't take effect until complete recording of all data.
That's why I'd like to record codedcharacterset=UTF8 at the first step - to eliminate the unnecessary step between steps 1 and 2.
This has essential meaning in processing a lot of photographs.

Phil Harvey

Quote from: VlCTOR on December 25, 2017, 02:54:19 PM
-Codedcharacterset=UTF8 is the first command in argument file.
But despite of that, the data from IPTC copies to XMP incorrectly.

The IPTC is decoded based on the existing CodedCharacterSet, not the one you are just writing.  So you may need a separate step to write CodedCharacterSet properly before copying the IPTC to XMP.  Alternatively, you can set -charset IPTC=UTF8 to force IPTC to be read as UTF8.

QuoteThis happens because codedcharacterset=UTF8 doesn't take effect until complete recording of all data.

Exactly.

QuoteThat's why I'd like to record codedcharacterset=UTF8 at the first step - to eliminate the unnecessary step between steps 1 and 2.

Yes, but that isn't what I was asking.  I was asking why you are trying to write the numeric value of this tag (ESC & G) instead of writing the converted value ("UTF8").  Regardless, I will add a check in the next ExifTool version to prevent you from writing "UTF8" as the numeric value for this tag, and will translate it automatically to "ESC & G" regardless of whether or not -n was used.

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

VlCTOR

Quote from: Phil Harvey on December 25, 2017, 07:48:30 PM
Alternatively, you can set -charset IPTC=UTF8 to force IPTC to be read as UTF8.
Excellent hint!
After adding the following lines to the argfile:
-charset
iptc=UTF8

the UTF8 encoding data copied correctly  from IPTC to XMP.

Quote
I was asking why you are trying to write the numeric value of this tag (ESC & G) instead of writing the converted value ("UTF8").
I tried to do this for the reason that the Geotag program always uses -n when calling Exiftool.
It's not my choice. This is idea of the Geotag authors.

Quote
Regardless, I will add a check in the next ExifTool version to prevent you from writing "UTF8" as the numeric value for this tag, and will translate it automatically to "ESC & G" regardless of whether or not -n was used.
Great idea, Phil. This is the best solution.