Bruce Ferrell wrote: > Somehow my data is being transformed. > > The CGI code is: > > #/bin/perl > > use CGI::Util qw( escape unescape make_attributes ); > use CGI; > use CGI qw( escapeHTML ); > > my $q = new CGI; > > my $data = $q->param( 'POSTDATA' ); > > print STDERR $data ."\n"; > > > The output is: > > <?xml version="1.0"?><event> > <type>ADD</type> > <message> > <custID>6ec973aa3f7a96e43f86b8d2aea0585ba3096c28</custID> > <custANI>5551313</custANI> > <msgtype>SMS</msgtype> > <SMSTarget>15551212</SMSTarget> > <SMSMessage>Test message sent from script %%DNAME%% %\xdaTE%% </SMSMessage> > <status>ALERT</status> > </message> > </event> > > And the input is: > > POSTDATA=<?xml version="1.0"?><event> > <type>ADD</type> > <message> > <custID>6ec973aa3f7a96e43f86b8d2aea0585ba3096c28</custID> > <custANI>5551313</custANI> > <msgtype>SMS</msgtype> > <SMSTarget>15551212</SMSTarget> > <SMSMessage>Test message sent from script %%DNAME%% %%DATE%% </SMSMessage> > <status>ALERT</status> > </message> > </event> > > any thoughts on why %%DATE%% is being transformed into %\xdaTE%% ? > >
Yes. Oh, you also want to know why. %DA is a valid two-hexadecimal number. HTTP will convert it into a single character. However, it shouldn't come out as \xda but as the character. Everything else that follows a % is not a valid two-hexadecimal number. To get around it, convert all the % into %25 %25%25DNAME%25%25 %25%25DATE%25%25 In fact, it's probably best to convert all non-alphanumerics into their corresponding two-hexadecimal numbers, including spaces and newlines. -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/