Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Distinguish between HTML and Plain text

by vit (Friar)
on Sep 26, 2011 at 23:26 UTC ( [id://927975]=note: print w/replies, xml ) Need Help??


in reply to Re: Distinguish between HTML and Plain text
in thread Distinguish between HTML and Plain text

But you can guess very reliably because HTML must have an HTML element
I forgot to mention that the html entered may be just a part of HTML, so assuming presence of "<html" tag will not work.
  • Comment on Re^2: Distinguish between HTML and Plain text

Replies are listed 'Best First'.
Re^3: Distinguish between HTML and Plain text
by ikegami (Patriarch) on Sep 26, 2011 at 23:36 UTC

    This is HTML:

    Please use <code>...</code> tags around your code.

    This is text:

    Please use <code>use strict;</code> in your code.

    How can one possibly correctly identify them programatically?

    PS - This is the reason Atom is better than RSS. RSS doesn't provide a mean of specifying the content type, so it can't distinguish between text and HTML content. Clients have to guess. You could take a peek at how RSS clients do it, but I suspect they might work with less ambiguous content than you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://927975]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-25 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found