A stupid and slighly long introduction
I wrote a pretty small online editor which allows me to easily change a couple of files on my webserver without having the need of using FTP.
Or so I thought.
The editor consists of a small form with a textarea and a submit button (oh and besides, for a little feeling of fake security, there is a password box :) ).
This form gets submitted to a Perl script which gets the form information through use CGI 'param' (because param is the only function of the CGI module I use).

The stupid problem
But the data from the textarea does not equal the data I entered. HTML entities like <,  , \ are changed by their actual characters.

A stupid solution
Of course I could write < in the editor (this would then render as < which is what I want) but then I should re-edit any HTML entities any time. As you can see, I don't quite feel like it.

The (stupid?) question
So my actual question(s): why does CGI eat them character entities? And how can I prevent it?
I could of course roll my own form parser, but that's, well, just stupid.


In reply to CGI module seems to eat html entities! by muba

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.