As you can see there is one encoded ampersand in each link but two un-encoded ampersands. The script that is making these ugly little varmints looks like this: (this is just a snippet)<div><strong>Search results (8 found, 8 shown)</strong><p> 1 - <a href="fcp.pl?words=water+and+fountain&wt=ew&bl=or&d=/link</ +a><br> 2 - <a href="fcp.pl?words=water+and+fountain&wt=ew&bl=or&d=/link</ +a><br> 3 - <a href="fcp.pl?words=water+and+fountain&wt=ew&bl=or&d=/link</ +a><br> 4 - <a href="fcp.pl?words=water+and+fountain&wt=ew&bl=or&d=/link</ +a><br> 5 - <a href="fcp.pl?words=water+and+fountain&wt=ew&bl=or&d=/link</ +a><br> </div>
etc etc.. As far as I can tell the problem is the "$search_bAND" thing. Problem is how do I change "AND" to & ? Any thoughts or suggestions are much appreciated thanks. Humble Regards Nathan.if(exists $form{'words'}) { $search_words = $form{'words'}; if($form{'wt'} eq 'be') {$search_wb = ' checked'; $search_ew = '';} else {$search_wb = ''; $search_ew = ' checked';} if($form{'bl'} eq 'an') {$search_bAND = ' checked'; $search_bOR = ''; +$search_bPHR = '';} elsif($form{'bl'} eq 'ph') {$search_bAND = ''; $search_bOR = ''; $sear +ch_bPHR = ' checked';} else {$search_bAND = ''; $search_bOR = ' checked'; $search_bPHR = '';} $wl = lc $search_words; $wl =~ tr/a-z0-9/ /c; $wl =~ s/(\A\s+)|(\s+\Z)//g; @words = split /\s+/, $wl; if($wl eq '' || $#words < 0) { $extra = "<font color=red>Please enter some words in the search box. +</font><br>"; @words = (); } else { $title = join ' ', 'Search results for', @words; } $search_q = $ENV{'QUERY_STRING'}; $search_q =~ s/\&pg=\d+//; } else { $search_words = ''; $search_wb = ' checked'; $search_ew = ''; $search_bAND = ''; $search_bOR = ' checked'; $search_bPHR = '';
20041009 Edit by castaway: Changed title from 'New to perl'
In reply to Parsing un-encoded ampersand in XHTML by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |