well, here's the scoop:
i've been working on a lyric database, and i finally came across an album that has a plus sign (+) in it. well, urlencode does this to it:
http://www.fandelem.com/lyrics/view.php?do=view&album=Wither+Blister+Burn+++Peel&artist_url=Stabbing+Westward&curletter=S
right, but when i click on it, IE translates it to:
http://www.fandelem.com/lyrics/view.php?do=view&album=Wither+Blister+Burn+%2B+Peel&artist_url=Stabbing+Westward&curletter=S
((no clue why that happens..))
however, i have code that does this:
$artist = stripslashes(urldecode($artist));
$album = stripslashes(urldecode($album));
well, with a plus sign in the album,artist,etc., and urlencode().. upon urldecode() the plus sign gets removed. and the query fails.
here is my workaround:
if ( !ereg("\+.+", $album) ) {
// no plus sign found
$album = stripslashes(urldecode($album));
}
however, my question: is this the best way of going about this?
i hope i'm being clear enough. basically, if i have a plus sign (you can see what i'm talking about if you go here: http://www.fandelem.com/lyrics/view.php?do=view&artist=Stabbing%20Westward&curletter=S )
and when i urldecode() this plus sign (that has already been urlencoded) it gets removed. so i test before i urldecode and if a plus sign exists, i do not decode it.. has anyone ran into this problem before? 🙂