Hi
I suppose I came over a very similar issue while building an spamtrap
which extracts attachements with MIME::Parser and feeds them down the
throat of clamav.
It boils more or down how perl threat UTF-8 strings on file functions
and how posix systems don't care about the encoding of filenames
What I found out to work with try and error, still not sure why:
use utf8;
use open ':std', ':encoding(UTF-8)';
[...]
my $filename = $part->head->recommended_filename;
open(SPAMFILE,">$spamdir/$filename");
print SPAMFILE $attachment;
close(SPAMFILE);
if (utf8::is_utf8($filename)) {
print "Filename IS UTF8, encode Filename for AV\n";
utf8::encode($filename); # This encodes UTF-8 Perl Strings to binary
string.
}
my ($path,$found) = $av->scan_path("$spamdir/$filename"); # Now Umlauts and
similar characters in the filename do not cause the file not to be found.
Mit freundlichen Grüssen
-Benoît Panizzon-
--
I m p r o W a r e A G - Leiter Commerce Kunden
______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 00
CH-4133 Pratteln Fax +41 61 826 93 01
Schweiz Web http://www.imp.ch
______________________________________________________
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.
Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang