public static function replaceBinaryStrings($message)
    {
        $lines = explode("\r\n", $message);

        foreach ($lines as &$line) {
            if (!mb_check_encoding($line, 'utf-8')) {
                $line = '<' . strlen($line) . ' bytes binary content>';
            }
        }

        return implode("\r\n", $lines);
    }
public static function replaceBinaryStrings($message)
    {
        $lines = explode("\r\n", $message);

        foreach ($lines as &$line) {
            if (!mb_check_encoding($line, 'utf-8')) {
                $line = '<' . strlen($line) . ' bytes binary content>';
            }
        }

        return implode("\r\n", $lines);
    }
public static function replaceBinaryStrings ( $ message ) { $ lines = explode ( "\r\n" , $ message ) ; foreach ( $ lines as & $ line ) { if ( ! mb_check_encoding ( $ line , 'utf-8' ) ) { $ line = '<' . strlen ( $ line ) . ' bytes binary content>' ; } } return implode ( "\r\n" , $ lines ) ; }
Replaces the lines containing binary strings with a human readable replacement.

@param string $message

@return string
Replaces the lines containing binary strings with a human readable replacement .