Win32::FindFile

Started by Jom, March 19, 2020, 03:04:41 AM

Previous topic - Next topic

Jom

Hello, Phill.

I can't make friendship ExifTool with  files that use Cyrillic in their names.
I found that it depends on Win32:: Find File.
Unfortunately, I have this.

PS F:\> cpanm install Win32::FindFile                                                         --> Working on install
Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/install-0.01.tar.gz ... OK
Configuring install-0.01 ... OK
Building and testing install-0.01 ... OK
Successfully installed install-0.01
--> Working on Win32::FindFile
Fetching http://www.cpan.org/authors/id/G/GR/GRIAN/Win32-FindFile-0.15.tar.gz ... OK
Configuring Win32-FindFile-0.15 ... OK
Building and testing Win32-FindFile-0.15 ... FAIL
! Installing Win32::FindFile failed. See C:\Users\andrei\.cpanm\work\1584600456.9600\build.log for details. Retry with --force to force install it.
1 distribution installed
PS F:\> exiftool -ver -v5                                                                     ExifTool version 11.91
Perl version 5.030002 (-C0)
Platform: MSWin32
Optional libraries:
  Archive::Zip                 1.68
  Compress::Zlib               2.093
  Digest::MD5                  2.55
  Digest::SHA                  6.02
  IO::Compress::Bzip2          2.093
  Time::Piece                  1.34
  Unicode::LineBreak           2019.001
  IO::Compress::RawDeflate     2.093
  IO::Uncompress::RawInflate   2.093
  Win32::API                   0.84
  Win32::FindFile              (not installed)
  Win32API::File               0.1203
Include directories:
  E:\software\ExifTool/lib
  C:/Strawberry/perl/site/lib/MSWin32-x64-multi-thread
  C:/Strawberry/perl/site/lib
  C:/Strawberry/perl/vendor/lib
  C:/Strawberry/perl/lib


I also found everything about Win32:: FindFile on the forum and came to the conclusion that ExifTool can no longer be used with non-Latin file names on Windows.

Please tell me, Phil, do I understand the situation correctly, or is there something I can do that I haven't been able to find out?

gnfalex

Greetings, Andrei Korzhyts
Did You tried "-charset  CP1251 -charset filename=CP1251"? It's works for me...
Best Regards.

Jom

Quote from: gnfalex on March 19, 2020, 05:10:46 AM
Greetings, Andrei Korzhyts
Did You tried "-charset  CP1251 -charset filename=CP1251"? It's works for me...
Best Regards.

Hello, gnfalex

Please tell me more detail what kind of terminal and command shell you use, and the command you enter?
I use PowerShell 5.1 and enter:

PS F:\> $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
>>
PS F:\> exiftool -charset  CP1251 -charset filename=CP1251 .\Фото.CR2
No matching files



Phil Harvey

Maybe try the --force option when installing Win32::FindFile.  It could have failed some test that wouldn't be a problem for 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 ($).

gnfalex

Sorry, i can't install PowerShell 5.1 - only 2.0. In 2.0 it's work without any additional commands...
I preffer cmd - and command look like "perl windows_exiftool -charset cp1251 -charset filename=cp1251 -filename -csv тест*.*"
AFAIK - "[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding" - changing codepages to UTF-8.
Please check "-charset  UTF8 -charset filename=CP1251".
You can also check encoding with Sysinternals Process Monitor - filter by "cr2" and find what filename it try to read.

Quote from: Andrei Korzhyts on March 19, 2020, 05:29:22 AM
Please tell me more detail what kind of terminal and command shell you use, and the command you enter?
I use PowerShell 5.1 and enter:
PS F:\> $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
>>
PS F:\> exiftool -charset  CP1251 -charset filename=CP1251 .\Фото.CR2
No matching files


Jom

Quote from: Phil Harvey on March 19, 2020, 07:30:04 AM
Maybe try the --force option when installing Win32::FindFile.  It could have failed some test that wouldn't be a problem for ExifTool.

- Phil

Yes, I've seen it and tried it. It doesn't help.

I've already done thousands of different experiments. Difficulties not only with file names, but also with tag values in Cyrillic. I tried PowerShell 5.1, cmd.exe, PowerShell 7 — nothing works. I tried different ways to change the encoding for them, but still the broken data reaches ExifTool. This happens somewhere between the terminal and ExifTool.

It is easier to migrate your process to Unix than to configure it on Windows.

But I got one way. If I access ExifTool via Perl (past PowerShell, etc.),

metadata.pl
system('exiftool -exif:copyright="(CCCC)© АндRei КорZhyts" -xmp-dc:rights="(C)© АндRei КорZhyts" -ext cr2 .');

perl metadata.pl

I can write data in Cyrillic, but the file names in Russian still don't reach ExifTool.

Now even Win32:: FindFile is not installed.
I want to know if Win32:: FindFile is still supported or not?
I can't understand it. It's a pity if this was the only way to read file names in Cyrillic.

Jom

exiftool -charset  UTF8 -charset filename=CP1251 -exif:copyright="(C)© АндRei КорZhyts" -xmp-dc:rights="(C)© АндRei КорZhyts" Фото.cr2

No. It doesn't help.
This is somewhere at the Windows level, maybe at the .NET level...
I'll have to spend some time trying to figure out how it works in Windows.
I'm sure there is a solution, but it's all so confusing

Phil Harvey

Win32::FindFile is distributed from here.  The latest version is from 2014, and has passed tests on 14 systems, but failed on 22. :(

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

Jom

What happened? Why supporting was stopped? Anybody know about it?
I see ExifTool still offers to install it. Why?

Phil Harvey

Quote from: Andrei Korzhyts on March 19, 2020, 10:26:21 AM
What happened? Why supporting was stopped? Anybody know about it?

You would have to ask the author.

QuoteI see ExifTool still offers to install it. Why?

I don't know of any alternatives.

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

obetz

#10
Quote from: Andrei Korzhyts on March 19, 2020, 10:26:21 AM
What happened? Why supporting was stopped? Anybody know about it?
I see ExifTool still offers to install it. Why?

I described the problem and a solution in https://exiftool.org/forum/index.php?topic=10135.msg52996#msg52996

Even the delivery of mails to the "maintainer" of Win32::FindFile "grian" fails.

Nobody seems to be interested to fix this long known error (see https://rt.cpan.org/Public/Dist/Display.html?Name=Win32-FindFile) in the automated test.

Really sad.

Oliver

Jom

#11
DST is always disabled initially — in my country, there are no transitions to winter and summer time.
On my computer, I still can't use ExifTool with non-Latin file names. Win32::FindFile also can't install in any way. If everything depends only on Win32::Find File, then it is probably not worth trying to solve this problem anymore. Just use only the Latin alphabet in the file names... And this is correct, so as not to depend on such situations.

obetz

Andrei, thanks for the information.

Would you mind to check the logs which error kept Win32::FindFile from installing?

After all, you can use my Strawberry Perl based package containing also Win32::FindFile.

Oliver

Phil Harvey

Quote from: Andrei Korzhyts on March 20, 2020, 05:38:53 AM
Win32::FindFile also can't install in any way.

You should be able to download the package from metapan then do this:

perl Makefile.PL
make install


It is not necessary to pass the tests before installing.

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

Jom

Which folder should I download the package to?
Somewhere inside the Strawberry folder?