I've been struggling to properly convert text into HTML with sensical escape codes from text that is pasted into a web form. The problem is that I can't count on the pasted text to be any particular encoding. Sometimes it comes from a web page in UTF-8, sometimes it's ISO-8859-1, and sometimes it's Windows 1252. I've done lots of Google searches, tried Text::Iconv (I get no output from it for some odd reason), and I've also tried Unicode::String (lossy conversion) and Unicode::Map8, all to no avail.
I thought that the browser did an encoding conversion based on the content-type header, but that doesn't seem to be the case. Is there any practical way to translate text submitted via a web form into HTML?
The server is Fedora 2, LANG is en_US.UTF-8. Clients are mostly Windows plus a few Mac OS X systems.
Thank You,
Troy
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.