I realize that this is not perl related but seeing so many CGI related posts leads me to believe that this is a fairly common problem using HTML forms.

I've only written four Web applications and even then under severe time constraints (which isn't very condusive to tidy code or indepth research), but in at least three of those applications I've encountered the same problem and haven't found a satisfactory solution. The problem is that TEXTAREA fields that contain an apostrophe (´) are truncated or completely obliterated upon submission.

So I guess the question is how should this situation be handled such that the apostrophes are preserved? The last application I wrote intercepted the submission via "onsubmit=" to a js sub, escaped the original TEXTAREA to a hiddent TEXTAREA field and then submitted the form.

It doesn't seem efficient to submit two TEXTAREA fields for each one on a given form. Nor does it seem efficient to create a shadowed hidden form and then submit only the hidden form data. There must be something obvious that I'm overlooking. I doubt that there is a Perl solution since the unescaped field never makes it (intact) to the Perl program once submitted.

Thanks for any advice. If someone could point me in the right direction (code is not necessary but welcome).

--Jim


In reply to (OT) TEXTAREA and the Single Quote by jlongino

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.