You are here: PB with euro sign and checkbox in multipart/form-data « HTML « IT news, forums, messages
PB with euro sign and checkbox in multipart/form-data

Posted by Yohan N. Leder on 05/19/06 01:06

Hi,

Hoping it will match the alt.html group, because already tried in
comp.lang.perl.misc but it seems to be more related to browser and
multipart/form-data posting.

Well, what do you think about the pb explained in this test script
called
form2dump.pl :

#!/usr/bin/perl -w
# Script written to solve the bug explained below :
# PB : € sign in any form field corrupt beginning of multipart/form-data
# in STDIN (1st lines with boundary & 1st field declar truncated)
# CAUSE : checkbox without any value (uncheckd) cause this pb
# - without <input type='checkbox' name='chk'>, it works
# - with <input type='checkbox' name='chk'> checked, it works
# NB : strange because an unchecked box shouldn't be sent !
# IDEA : I've tried to provide an hidden field with same name as
# checkbox which would submit an 'off' value when checkbox is
# unchecked, but both values are sent when checkbox is checked
# SOL : ?

print "Content-type: text/html; charset=iso-8859-1\n\n";
if ($ENV{'QUERY_STRING'} =~ /add/)
{
read STDIN, my $buff, $ENV{'CONTENT_LENGTH'};
print "<b>Multipart/form-data (ok because no binary data inside)
</b><hr>$buff";
}
else
{
print <<FORM;
<form action='/cgi-bin/form2dump.pl?add'
method='post' enctype='multipart/form-data' accept-charset='iso-8859-
1'>
<input type='text' name='txt1'><br>
<input type='text' name='txt2'><br>
<input type='text' name='txt3'><br>
<input type='text' name='txt4'><br>
<input type='text' name='txt5'><br>
<input type='submit'>
<input type='checkbox' name='chk' value='on'>
</form>
FORM
}
exit 0;

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация