eml002
eml002

Reputation: 431

Convert file to HTML entitites

Is there are way to convert the contents of a file into html entities?

The file has header information formatted as: .

i.e. ##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">

Right now the output just looks like:##INFO=

Is there a way to keep the html-like tags and have php output exactly how what it says/how it is formatted in the text file?

Thanks!

Upvotes: 0

Views: 53

Answers (2)

Suresh Kumar Amrani
Suresh Kumar Amrani

Reputation: 935

You can use htmlenities ();

You need a valid character in the default ISO-8859-1 character set, so it's not decoded. Define UTF-8 as the output charset and it will decode:

echo html_entity_decode('html', ENT_NOQUOTES, 'UTF-8');

If at all possible, you should avoid HTML entities to begin with.

Upvotes: 0

SLaks
SLaks

Reputation: 887215

You're looking for the htmlentities() function, which will HTML-escape text.

Upvotes: 1

Related Questions