Are there any scripts that can convert between text (e.g. <hi>
) and the html entities version (<hi>
) like this website does? Or at least a PHP file?
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
||||
|
The perl CGI module has a
Or to do an entire file:
|
|||
|
|
|||
|
I'm not sure of your original goal/purpose, but if you are wanting to show PHP source to someone -- You can rename the file to *.phps extension and (in many Apache/PHP configurations, but not all) it will not parse the PHP when serving the file to the user; it will show the source directly. |
|||
|
The recode utility supports HTML as one of the encodings. (You can even specify an HTML version.) In the text-to-entities direction, it will also recode non-ASCII characters into entities; you need to specify the correct input encoding (e.g. ASCII, latin1, utf-8, …).
|
||||
|