perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Christophe Boggio <>
Subject Problem with file upload
Date Tue, 30 Sep 2008 13:48:41 GMT

I have a fully UTF8 encoded site in which I want users to upload files
(simple <input type="file...> form).
These files are ISO-8859-1 encoded.

My problem is that sometimes the file is correctly uploaded and
sometimes it is converted to something stupid :

==>correct :
$ hd sconet1.csv |head -1
00000000  4e 6f 6d 3b 50 72 e9 6e  6f 6d 20 31 3b 44 61 74  |Nom;Pr.nom 1;Dat|

==>bad :
$ hd sconet1.csv |head -1
00000000  4e 6f 6d 3b 50 72 ef bf  bd 6e 6f 6d 20 31 3b 44  |Nom;Pr...nom 1;D|

The problem seems completely random, sometimes pressing F5 a few times makes
the upload work.

The code I use is this :
		open(FILE,">:encoding(iso-8859-1)","sconet1.csv") or print OUT $!;
		my $buffer;
		while (read($fdat{efilename},$buffer,32768)) {
			print FILE $buffer;

I have tried removing the second param to open() but it changes nothing.

The problem arises in Firefox and IE so I guess the problem is server-side.

At the beginning of _base.epl I have this :
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

Can I force a "pure binary" upload/save of the file ?

*any* clue much appreciated. I'm getting mad with this...



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message