iconv_mime_encode example

if (!function_exists('iconv')) {
    function iconv(?string $from_encoding, ?string $to_encoding, ?string $string): string|false { return p\Iconv::iconv((string) $from_encoding(string) $to_encoding(string) $string)}
}
if (!function_exists('iconv_get_encoding')) {
    function iconv_get_encoding(?string $type = 'all'): array|string|false { return p\Iconv::iconv_get_encoding((string) $type)}
}
if (!function_exists('iconv_set_encoding')) {
    function iconv_set_encoding(?string $type, ?string $encoding): bool { return p\Iconv::iconv_set_encoding((string) $type(string) $encoding)}
}
if (!function_exists('iconv_mime_encode')) {
    function iconv_mime_encode(?string $field_name, ?string $field_value, ?array $options = []): string|false { return p\Iconv::iconv_mime_encode((string) $field_name(string) $field_value(array) $options)}
}
if (!function_exists('iconv_mime_decode_headers')) {
    function iconv_mime_decode_headers(?string $headers, ?int $mode = 0, ?string $encoding = null): array|false { return p\Iconv::iconv_mime_decode_headers((string) $headers(int) $mode$encoding)}
}

if (extension_loaded('mbstring')) {
    if (!function_exists('iconv_strlen')) {
        function iconv_strlen(?string $string, ?string $encoding = null): int|false { null === $encoding && $encoding = p\Iconv::$internalEncodingreturn mb_strlen((string) $string$encoding)}
    }
    if (!function_exists('iconv_strpos')) {
        function iconv_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { null === $encoding && $encoding = p\Iconv::$internalEncodingreturn mb_strpos((string) $haystack(string) $needle(int) $offset$encoding)}
    }

    protected function prepQEncoding($str)
    {
        $str = str_replace(["\r", "\n"], '', $str);

        if ($this->charset === 'UTF-8') {
            // Note: We used to have mb_encode_mimeheader() as the first choice             // here, but it turned out to be buggy and unreliable. DO NOT             // re-add it! -- Narf             if (extension_loaded('iconv')) {
                $output = @iconv_mime_encode('', $str[
                    'scheme'           => 'Q',
                    'line-length'      => 76,
                    'input-charset'    => $this->charset,
                    'output-charset'   => $this->charset,
                    'line-break-chars' => $this->CRLF,
                ]);

                // There are reports that iconv_mime_encode() might fail and return FALSE                 if ($output !== false) {
                    // iconv_mime_encode() will always put a header field name.                     // We've passed it an empty one, but it still prepends our
if (!function_exists('iconv')) {
    function iconv($from_encoding$to_encoding$string) { return p\Iconv::iconv($from_encoding$to_encoding$string)}
}
if (!function_exists('iconv_get_encoding')) {
    function iconv_get_encoding($type = 'all') { return p\Iconv::iconv_get_encoding($type)}
}
if (!function_exists('iconv_set_encoding')) {
    function iconv_set_encoding($type$encoding) { return p\Iconv::iconv_set_encoding($type$encoding)}
}
if (!function_exists('iconv_mime_encode')) {
    function iconv_mime_encode($field_name$field_value$options = []) { return p\Iconv::iconv_mime_encode($field_name$field_value$options)}
}
if (!function_exists('iconv_mime_decode_headers')) {
    function iconv_mime_decode_headers($headers$mode = 0, $encoding = null) { return p\Iconv::iconv_mime_decode_headers($headers$mode$encoding)}
}

if (extension_loaded('mbstring')) {
    if (!function_exists('iconv_strlen')) {
        function iconv_strlen($string$encoding = null) { null === $encoding && $encoding = p\Iconv::$internalEncodingreturn mb_strlen($string$encoding)}
    }
    if (!function_exists('iconv_strpos')) {
        function iconv_strpos($haystack$needle$offset = 0, $encoding = null) { null === $encoding && $encoding = p\Iconv::$internalEncodingreturn mb_strpos($haystack$needle$offset$encoding)}
    }
Home | Imprint | This part of the site doesn't use cookies.