[Feature] Windows Unicode cmdline support

Started by kemsky, March 27, 2012, 05:56:44 AM

Previous topic - Next topic

kemsky

Hi, Phil

Windows has 2 types of cmdline encodings : system default and Unicode, which one is used depends on executable main function (main and wmain).

I don't know much about compiling perl program into *.exe, but i suspect that only system default encoding is supported now (for example you have to switch system encoding to japanese to be able to process files with japanese names).

I've investigated similar issue with ImageMagick some time ago: http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=19242.

So i would like to know is it possible to add this feature to exiftool?


Phil Harvey

This has been a problem for quite some time, but I haven't found a solution yet.

However, looking again I just found this solution which sounds promising.  I will try 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 ($).

kemsky

One of the possible places (and the most probable) where encoding is broken - executable wrapper (if it does not use wmain function we have to search for another build tool). Simple test can show it: compile program that takes Unicode parameter converts it to utf8 and prints to file.

I've tried to look through exiftool sources/makefiles, but could not find where exactly executable is created.

The solution from stackoverflow is not actually a solution: they just using function to detect system default  encoding and convert to any encoding they need, example: if system default - russian then you can only pass russian and english file names, but japanese will fail and so on.

If you explain me how wrapper is created i will try to help.

Thanks.


Phil Harvey

The exiftool executable is created using the PAR module, same as in the stackoverflow thread.

Unfortunately I don't know the details about the inner working of PAR.

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

kemsky

I think you could  try GetCommandLineW function (http://msdn.microsoft.com/en-us/library/windows/desktop/ms683156%28v=vs.85%29.aspx)



Phil Harvey

Thanks for the suggestion.  I'll look into it.

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