Let's say that I have a variable that looks like this:
$foo = 'And then they said, "howdy!"';
This variable then goes into an <input> element like so:
<input type="hidden" name="foo" value="$foo">
There's an obvious problem here that the double-quote in the value is going to mess up the page, and not send the full value; eg,
<input type="hidden" name="foo" value="And then they said, "howdy!"">
makes the page think that the value is "And then they said, " and then there's just arbitrary text in the tag of howdy!"".
I know that I could escape the "" in $foo with \", or change them to something like %22, but then when I process it in Perl the program won't know whether the \ or %22 are literal or intended to be converted.
My next fix was to replace double quotes with something like, "::phranqueistheman::, but that's going to send me down a path where I'll need to modify 65 different scripts to recognize this :-O
So before I go down that particular rabbit hole, is there an easier fix?