X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=ucw%2Fperl%2FUCW%2FCGI.pm;h=de39d226aad349f54810f9092338f0ac16b3ec27;hb=68de14ab2618ebf4afa9630299cef5eafe13d1be;hp=f81bd3ea300da22776457a5cf0b52ed34f17791b;hpb=5453cb799a65190b348028302249af928c58cee4;p=libucw.git diff --git a/ucw/perl/UCW/CGI.pm b/ucw/perl/UCW/CGI.pm index f81bd3ea..de39d226 100644 --- a/ucw/perl/UCW/CGI.pm +++ b/ucw/perl/UCW/CGI.pm @@ -50,8 +50,10 @@ sub url_deescape($) { sub url_param_escape($) { my $x = shift @_; defined $x or return; - $x = url_escape($x); + utf8::encode($x) if $utf8_mode; + $x =~ s/([^-\$_.!*'(),0-9A-Za-z])/"%".unpack('H2',$1)/ge; $x =~ s/%20/+/g; + utf8::decode($x) if $utf8_mode; return $x; } @@ -369,6 +371,10 @@ sub parse_multipart_form_data() { print STDERR "FILE UPLOAD to $fn\n" if $debug; ${$a->{"file"}} = $fn; ${$a->{"fh"}} = $fh if defined $a->{"fh"}; + if (defined $a->{"filename"}){ + my ($filename) = ($cdisp =~ /;filename=([^;]+)/); + (${$a->{"filename"}}) = rfc822_deescape($filename) if defined $filename; + } my $total_size = 0; while (my $i = refill_mp_data(4096)) { print $fh substr($mp_buffer, $mp_buffer_i, $i);