Boston Linux & UNIX was originally founded in 1994 as part of The Boston Computer Society. We meet on the third Wednesday of each month, online, via Jitsi Meet.

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Seeking information on binaries called "entities" and "fixup"



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 &quot; or &#213; alone
 * @see http://www.php.net/manual/en/regexp.reference.assertions.php
 * @param string $message
 * @return string
 */
function entitySafe($message)
{
return preg_replace('/&(?!#?\w+;)/', '&amp;', $message);
}

Greg Rundlett
http://eQuality-Tech.com <http://equality-tech.com/>
http://freephile.org



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org