"I'm not talking about what's done by the web protocol. These fields are POSTed. What the PM engine receives is what the user typed into the box"
I'm not entirely sure what you mean. When I type into the box, I'm doing so on my local machine/device/browser. What I type is URL encoded by my browser before being sent out over the internet. Regardless if it is GET or POST.
The PM engine (Perl Monks / Everything engine port ?) receives a URL encoded string of texts from the submit form, that looks something like:
text=This%20is%20my%20post%20sent%20to
%20PerlMonks%3CBR%3E%0D%0ATom
At some point somewhere, at minimum, the URL encoding needs to be decoded.
I don't know exactly where that takes place on PerlMonks. All I know is most CGI programs do URL decoding immediately upon reception while the data is still in Ram memory. At the same time it would usually be checked for "illegal" characters. These would be either removed or replaced with some safe alternative before the data is written to any file.
IMO, if anyone cared to do so, this would also be the sensible time to replace newline characters with some HTML equivalent.
That is how I do it, in any of the forum or message board programs I've written.
This would have no effect on anything already in the database, or how anything already in the database is handled normally, it would only effect new posts.
It seems obvious to me at this point, judging by the general ridicule and down voting, that all this is either not understood, (unlikely considering) or not wanted.
So I will leave it at that. IMO if it was needed, wanted or desired, that "return" or newline characters be converted to HTML equivalents, so that did not have to be done manually all the time, that is how I would do it. At the time the data is first received, at the same time that the URL encoding is being decoded, which in my experience, generally always is handled before the post is sent to the database.
I don't know why anyone would hit return while posting to a forum unless they wanted it to display as such in the browser. So I would not anticipate this ever being a problem.
Though the use of the code tag might complicate this a bit. That is something I've never encountered previously. At least not how PM handles it.
Seems like, in general, it is looked upon as a bad idea, so I'll drop it.
Tom
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.