[Discuss] Seeking information on binaries called "entities" and "fixup"
Greg Rundlett (freephile)
greg at freephile.com
Thu Jul 31 10:32:09 EDT 2014
On Sun, Jul 27, 2014 at 11:08 PM, Bill Horne <bill at horne.net> wrote:
> I'm moving the Telecom Digest to a new server, and I'm seeking information
> about a binary named "entities", and one named "fixup". I've found them in
> a script that processes emails into html pages for publications, but the
> script's author isn't available, and neither is working.
>
> AFAICT, "entities" is supposed to replace ASCII characters with HTML
> Entities where needed, and I don't know what "fixup" is supposed to do.
>
>
[replying to all this time]
Here is a PHP function that could help you replace the 'entities' binary
/**
* Replaces ampersands with html entity, making it safe for XML
* use lookahead assertion that the ampersand is not followed by an
optional hash, one or more
* word characters and a semicolon. In other words, it WILL match if it's
a bare ampersand,
* such as in the string "H&R Block" but
* will leave friendly entities like " or Õ alone
* @see http://www.php.net/manual/en/regexp.reference.assertions.php
* @param string $message
* @return string
*/
function entitySafe($message)
{
return preg_replace('/&(?!#?\w+;)/', '&', $message);
}
Greg Rundlett
http://eQuality-Tech.com <http://equality-tech.com/>
http://freephile.org
More information about the Discuss
mailing list