I have a form with a couple of form fields that have a 4000 character limit. I put in place some JS code that fails form submission if any of the fields are 4001+.

The problem is that some strings that the JS code finds to be < 4000, Oracle does not and everything comes crashing down. I decided to throw in an extra check w/in my Perl code that does a substr($x, 0, 4000) on all values, just to double check.

The problem I found, however, the string that JS and wc think is 4000, Perl thinks is 4052. I'm assuming that this has something to do with line breaks, etc. Perl truncates the string down to what it thinks is 4000 characters, but it's actually hacking off a chunk of the user's input.

So, my question is in regard to matching up what JS and Oracle think is 4000 characters to what Perl thinks is 4000 characters. How do I get Perl to recognize this difference?

In reply to truncating form field input to 4000 characters by emilford

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.