Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: "E!" Newsgroups: scea.yaroze.problems.internet Subject: Edit website tag formatting error... Date: Wed, 04 Feb 1998 18:30:14 -0800 Organization: . Lines: 76 Message-ID: <34D92436.7A6050DE@cisco.com> Reply-To: tenchi@cisco.com NNTP-Posting-Host: dhcp-e-39-245.cisco.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.03 [en] (Win95; U) Hm... a funky error that I got while editing my Yaroze site today. The members site editor http://www.scea.sony.com/net/yaroze/pages/edithtml.cgi has a formatting error. Any "escaped" sequences are not "unescaped" when you edit your page for a second time. Example: - edit your HTML for any page, insert the following, and then click "Enter Changes": This like has a less-than sign: <.
This one has a greater-than sign: >. - the HTML output should look like: This like has a less-than sign: <. This one has a greater-than sign: >. - this is fine. However, now look at the HTML code in the textarea box when you edit the page again: This like has a less-than sign: <.
This one has a greater-than sign: >. While this normally wouldn't concern me, what if you had the following statement in your page: This page is great! <g>
The next time you edit it, you would see in the textarea box: This page is great!
So, a subsequent "Enter Changes" would result in the creation of a "" tag, at which point the browsers will either ignore it or become confused. When the CGI recreates the page, it should probably at least do the following: - turn all " into " - turn all < into < The text in the textarea box should be correct. If it's in Perl, this is something I commonly use when formatting output: # in: any amount of text you want Web-ized # out: a formatted set of strings # desc: formats a series of text strings for browsers ^_^ sub WebString { my( @input ) = @_; my( @output,$line ); @output = (); foreach $line (@input) { $line =~ s/\&/\&/g; $line =~ s//\>/g; $line =~ s/\"/\"/g; push( @output,$line ); } # foreach $line (@input) return( @output ); } Thanks! - Elliott tenchi@netmagic.net www.netmagic.net/~tenchi