in reply to Re^2: Plain Text To HTML
in thread Plain Text To HTML

I use a form to input information to a program to display a webpage. One part of that form is a text-area into which one can type input, or simply paste a Word document.

This suggests to me that the idea is not to read a .docx file but that a user pastes content (with or without formatting?) into a webpage, which is backed by a Perl CGI script.

Replies are listed 'Best First'.
Re^4: Plain Text To HTML
by LanX (Saint) on Sep 19, 2024 at 13:14 UTC
    > that a user pastes content

    Or he drags&drops a file, which is uploaded.

    But yes I also expect copy and paste

    > (with or without formatting?)

    And that's exactly the point, in what way is a pasted text still "Word"? ¹

    I've already seen ...

    • plain text
    • plain text with "markup"
    • RTF
    • HTML
    • various abominations of the MS universe (OLE, etc)

    ... copied out of Word.

    It also depends on the OS, the intermediate Clipboard, browser and attributes of the receiving textarea² used in the form.

    The OP is keeping us guessing, instead of just showing us the exact text he gets inside his CGI.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

    ¹) or to even quote the OP twice a "Word document"

    ²) "newer" browsers allow WYSIWYG editing