]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/perl/UCW/CGI.pm
tableprinter: bugfix in TBL_COL_ITER macro
[libucw.git] / ucw / perl / UCW / CGI.pm
index f81bd3ea300da22776457a5cf0b52ed34f17791b..de39d226aad349f54810f9092338f0ac16b3ec27 100644 (file)
@@ -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);