protected function EncodeFile($path, $encoding = 'base64')
    {
        try {
            if (!is_readable($path)) {
                throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE);
            }
            if (function_exists('get_magic_quotes')) {
                function get_magic_quotes()
                {
                    return false;
                }
            }
            if (version_compare(PHP_VERSION, '5.2.0', '<')) {
                $magic_quotes = get_magic_quotes_runtime();
                set_magic_quotes_runtime(0);
            }
            $file_buffer = file_get_contents($path);
            $file_buffer = $this->EncodeString($file_buffer, $encoding);
            if (version_compare(PHP_VERSION, '5.2.0', '<')) {
                set_magic_quotes_runtime($magic_quotes);
            }
            return $file_buffer;
        } catch (Exception $e) {
            $this->SetError($e->getMessage());
            return '';
        }
    }