Ejemplo n.º 1
0
/**
 * NCR encodes matches from a preg_replace.
 * Single byte characters are preserved.
 *
 * @param	string	The character to encode
 * @return	string	The encoded character
 */
function ncrencode_matches($matches, $skip_ascii = false)
{
	$ord = ord($matches[0]);

	if ($skip_ascii AND $ord < 128)
	{
		return $matches[0];
	}

	return '&#' . ord_uni($matches[0]) . ';';
}
Ejemplo n.º 2
0
/**
 * NCR encodes matches from a preg_replace.
 * Single byte characters are preserved.
 *
 * @param	string	The character to encode
 * @return	string	The encoded character
 */
function ncrencode_matches($matches, $skip_ascii = false, $skip_win = false)
{
    $ord = ord_uni($matches[0]);
    if ($skip_win) {
        $start = 254;
    } else {
        $start = 128;
    }
    if ($skip_ascii and $ord < $start) {
        return $matches[0];
    }
    return '&#' . ord_uni($matches[0]) . ';';
}