--- loncom/cgi/loncgi.pm 2005/05/03 22:22:47 1.4 +++ loncom/cgi/loncgi.pm 2006/04/10 17:46:04 1.6 @@ -1,7 +1,7 @@ # # LON-CAPA helpers for cgi-bin scripts # -# $Id: loncgi.pm,v 1.4 2005/05/03 22:22:47 albertel Exp $ +# $Id: loncgi.pm,v 1.6 2006/04/10 17:46:04 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -52,16 +52,11 @@ package LONCAPA::loncgi; use strict; use warnings FATAL=>'all'; no warnings 'uninitialized'; -use vars qw(%env); use CGI(); use CGI::Cookie(); use Fcntl qw(:flock); use LONCAPA::Configuration(); -require Exporter; - -#our @ISA = qw (Exporter); -#our @EXPORT = qw(%env); my $lonidsdir; @@ -155,7 +150,9 @@ sub transfer_profile_to_env { } foreach my $envrow (@profile) { chomp($envrow); - my ($envname,$envvalue)=split(/=/,$envrow); + my ($envname,$envvalue)=split(/=/,$envrow,2); + $envname = &unescape($envname); + $envvalue = &unescape($envvalue); $Apache::lonnet::env{$envname} = $envvalue; } $Apache::lonnet::env{'user.environment'} = "$lonidsdir/$handle.id"; @@ -165,6 +162,21 @@ sub transfer_profile_to_env { ############################################# ############################################# +sub escape { + my $str=shift; + $str =~ s/(\W)/"%".unpack('H2',$1)/eg; + return $str; +} + +# ----------------------------------------------------- Un-Escape Special Chars + +sub unescape { + my $str=shift; + $str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; + return $str; +} + + =pod =back