imap_utf8

(PHP 4, PHP 5)

imap_utf8Converts MIME-encoded text to UTF-8

Описание

string imap_utf8 ( string $mime_encoded_text )

Converts the given mime_encoded_text to UTF-8.

Список параметров

mime_encoded_text

A MIME encoded string. MIME encoding method and the UTF-8 specification are described in » RFC2047 and » RFC2044 respectively.

Возвращаемые значения

Returns an UTF-8 encoded string.

Смотрите также

Коментарии

To get a complete decode to utf8 (which is the protocol with "national" characters), use these two:
$subject = "=?ISO-8859-1?Q?B=F8lla?=, med =?ISO-8859-1?Q?=F8l?= i baggen";
$subject = imap_utf8($subject);
$subject = utf8_decode($subject);
will return the subject in 8-bit ascii.
That is, both functions.

knutm :-)
2002-10-31 05:53:13
http://php5.kiev.ua/manual/ru/function.imap-utf8.html
# this script are correct with the right signs remove expression
# please, ignore the later.
function decode_utf8($str){
       # paterns
           $err="(=\?.{10,13}q\?_?|\?\=)";
           $pat = "/=([0-9A-F]{2})/"; 
           $cha="'.chr(hexdec(";
       # erase null signs in string
          $str=eregi_replace($err,"",$str);
       # to decode with eval and replace
          eval("\$str='".
                  preg_replace($pat,$cha."'$1')).'",$str)
                  ."';");
        # return
           return $str;

#Note: you can to reduce this script in 3 lines.
2005-02-14 14:01:55
http://php5.kiev.ua/manual/ru/function.imap-utf8.html
Also see: 
<?php
imap_mime_header_decode
($sting);
?>
Don't try to decode subjects with this one... imap_mime_header_decode does a much better job at that.
2005-09-19 07:42:29
http://php5.kiev.ua/manual/ru/function.imap-utf8.html
You may also try this example:

$_subject = "=?iso-8859-1?b?THV6b26uMTQ=?= dot CoM";
echo utf8_decode(imap_utf8($_subject));

OUTPUT: Luzon®14 dot CoM

Regards,
Tuso/Nazareth
2007-07-30 03:43:02
http://php5.kiev.ua/manual/ru/function.imap-utf8.html
Автор:
Be aware: imap_utf8 tends to return the string in uppercase.
2009-06-22 16:24:50
http://php5.kiev.ua/manual/ru/function.imap-utf8.html
string in uppercase error http://bugs.php.net/bug.php?id=44098
my function to decode string

<?php
function decodeMimeStr($string$charset="UTF-8" )
{
     
$newString '';
     
$elements=imap_mime_header_decode($string);
      for(
$i=0;$i<count($elements);$i++) 
      {
        if (
$elements[$i]->charset == 'default')
         
$elements[$i]->charset 'iso-8859-1';
       
$newString .= iconv($elements[$i]->charset$charset$elements[$i]->text);
      }
      return 
$newString;
}
?>
2009-07-06 05:43:35
http://php5.kiev.ua/manual/ru/function.imap-utf8.html
That fixed the all caps issue:

<?php
function imap_utf8_fix($string) {
  return 
iconv_mime_decode($string,0,"UTF-8");
}
?>
2011-01-26 07:12:10
http://php5.kiev.ua/manual/ru/function.imap-utf8.html
Use  iconv_mime_decode();

<?php
// This yields "Subject: Prüfung Prüfung"
echo iconv_mime_decode("Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=",
                       
0"ISO-8859-1");
?>

http://php.net/manual/de/function.iconv-mime-decode.php
2011-10-17 18:08:03
http://php5.kiev.ua/manual/ru/function.imap-utf8.html

    Поддержать сайт на родительском проекте КГБ