private function filterAndDecode($str)
    {
        $ret = str_replace("\r", '', $str);
        $ret = preg_replace('/[^\x21-\xf5`\n]/', '`', $ret);
        if ($this->position === 0) {
            $matches = [];
            if (preg_match('/^\s*begin\s+[^\s+]\s+([^\r\n]+)\s*$/im', $ret, $matches)) {
                $this->filename = $matches[1];
            }
            $ret = preg_replace('/^\s*begin[^\r\n]+\s*$/im', '', $ret);
        } else {
            $ret = preg_replace('/^\s*end\s*$/im', '', $ret);
        }
        return convert_uudecode(trim($ret));
    }