Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

imap_utf8

(PHP 3 >= 3.0.13, PHP 4, PHP 5)

imap_utf8 -- Converts 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.

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

imap_mime_header_decode()



Informix> <imap_utf7_encode
Last updated: Fri, 26 Jan 2007
 
add a note add a note User Contributed Notes
imap_utf8
Anonymous webmaster@luzon14DoTCom
30-Jul-2007 12:43
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
hans at lintoo dot dk
19-Sep-2005 04:42
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.
marcelo at maccoy dot com dot br
14-Feb-2005 12:01
# 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.
aperez at informatica dot 24ruedas dot com
11-Jun-2004 02:48
Here's my new better function... ;)

function decode_ISO88591($string)
{               
  $string=str_replace("=?iso-8859-1?q?","",$string);
  $string=str_replace("=?iso-8859-1?Q?","",$string);
  $string=str_replace("?=","",$string);

  $charHex=array("0","1","2","3","4","5","6","7",
                  "8","9","A","B","C","D","E","F");
       
  for($z=0;$z<sizeof($charHex);$z++)
  {
    for($i=0;$i<sizeof($charHex);$i++)
    {
      $string=str_replace(("=".($charHex[$z].$charHex[$i])),
                         chr(hexdec($charHex[$z].$charHex[$i])),
                         $string);
    }
  }
  return($string);
}

Hope this helps. :)
aperez at informatica dot 24ruedas dot com
10-Jun-2004 12:05
I got issues decoding strings with spanish characters. I found encodeISO88591() function at this manual as an user note.

After having problems with imap_utf8() and utf8_decode(), I've decided create a function decodeISO88591() for decoding strings encoded with encodeISO88591().

Here's the code(I've translated remarks and variable and array names from spanish to english for better understanding):

function encodeISO88591($string)
{
  // ISO-8859-1 string header
  $stringISO = "=?iso-8859-1?q?";
 
  // Each character are encoded('equal-to' symbol + hexadecimal value from ASCII code)
  for($i=0;$i<strlen($string);$i++)
  {
    // Basic ASCII characters are not encoded
    if(ord(substr($string,$i,1))<1 || ord(substr($string,$i,1))>127)
    {
      $char = ord($string[$i]);
      $char = strtoupper(dechex($char));
      $stringISO.="=".$char;
    }
    else
    {
      $stringISO.=substr($string,$i,1);
    }
  }
 
  // ISO-8859-1 string footer
  $stringISO.="?= ";
 
  return($stringISO);
}

// And this is my function decodeISO88591()

function decodeISO88591($string)
{
  // Arrays for obtaining hexadecimal values
  // for each ISO-8859-1 charset
  $mAlfa=array("A","B","C","D","E","F");
  $mNum=array();
  for($n=0;$n<10;$n++)
  {
    $mNum[]=$n;
  }
 
  // ISO-8859-1 charset
  $iso88591=array(" ","
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571