Subject: Re: Forms, CGI ans special charaters
From: Dave Jones <David.T.Jones@xxxxxxx>
Date: Wed, 29 Jul 1998 15:21:39 +0100
|
All,
I have managed to fix my problem with the special characters.
Conversion to ASCII can be accomplished by including the following.
# Convert plus's to spaces
$parseString =~ s/\+/ /g;
# Convert %xx URLencoded to equiv ASCII characters
$parseString =~ s/%(..)/chr(hex($1))/ge;
Browsers don't display "<" chars as it could represent a tag in
html. To get round the problem, you need to do the following
conversion for the 'main' special characters in HTML.
# Convert < > & " to 'html' special characters.
$parseString =~ s/&/\&/g;
$parseString =~ s/</\</g;
$parseString =~ s/>/\>/g;
$parseString =~ s/"/\"/g;
< < (less than sign)
> > (greater than sign)
& & (The ampersand sign itself)
" " (double quote)
FYI more info on special characters can be had here
http://www.sandia.gov/sci_compute/symbols.html
Cheers,
Dave.
At 12:13 PM 7/29/98 +0100, Dave Jones wrote:
>WEB Masters,
>
>Has anybody tried passing an xml/sgml code through a form, I've got
>a perl xml parser which awaits the input from a web form. However
>when the form data arrives, it is URL encoded. There are perl programs
>which convert this back to ascii, however some of the xml characters
>namely "<" seem to corrupt the conversion, and when displaying back to
>the web page I end up with text which is only showing the non encoded
>characters.
>
>Cheers
>Dave.
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|