Hello,
I have a big problem :'(
See my script :
#!/usr/bin/perl
use encoding qw(utf8);
use open qw(:std utf8);
use Image::ExifTool;
system 'exiftool -Artist="Azerty" -Copyright="Qwerty" -q -q -fast -overwrite_original /home/fabrice/Bureau/monImage.jpg';
my $exifTool = new Image::ExifTool;
$exifTool->Options(FastScan => 1);
$exifTool->SetNewValue(Artist => 'Wxcvbn');
$exifTool->SetNewValue(Copyright => 'Uiopmlkj');
$exifTool->WriteInfo('/home/fabrice/Bureau/monImage.jpg');
It doesn't work :
Incompatible encoding!
Compilation failed in require at Bureau/et.pl line 5.
BEGIN failed--compilation aborted at Bureau/et.pl line 5
Can you help me please ?
Hi,
Your first line (setting the encoding to "utf8") is incompatible with Image-ExifTool because it breaks the ability to treat strings as a series of bytes.
- Phil
Edit: FYI, here is a link (http://www.gossamer-threads.com/lists/perl/porters/215230?do=post_view_threaded) to a perl-porters thread in which Tom Christiansen (co-author of "Programming Perl") discusses the problem, and this thread (http://www.gossamer-threads.com/lists/perl/porters/215372?do=post_view_threaded) which concluded the discussion.
Thanks for you reply.
But all problem's have a solution...
This is my program :
- program files are encoded in UTF8 without BOM,
- it using UTF8 characters (é à...),
- it write files using UTF8 characters, so it must write files in UTF8.
So, in my program, I have changed use encoding qw(utf8); use open qw(:std utf8); by use utf8; use open OUT => ':utf8';.
And it works.
http://www.gossamer-threads.com/lists/perl/porters/215382?do=post_view_threaded#215382
New code for UTF8 support :
use open(IO => ':encoding(utf8)');
binmode(STDERR, ':utf8');
binmode(STDOUT, ':utf8');
binmode(STDIN, ':utf8');
open(FILE, '>:utf8', '/tmp/azerty');
It works better, but, I don't know if this code is very good.
Moreover ExifTool continue to work.
Stop spaming.
Thanks for your previous help.
I can't answer your question about whether or not this technique is good. I haven't ever done anything like this myself.
- Phil