note 28084 modified in function.imap-mime-header-decode by jmcastagnetto

From: Date: Wed, 01 Jan 2003 22:29:46 +0000
Subject: note 28084 modified in function.imap-mime-header-decode by jmcastagnetto
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-41555@lists.php.net to get a copy of this message
imap_mime_header_decode, utf-7 and utf-8 problem, i solved the problem using below function. note that iconv function for code converting. you must replace "EUC-KR" as iconv parameter with charset you want such as "iso-8859-1". function mime_decode($s) { $elements = imap_mime_header_decode($s); for($i = 0;$i < count($elements);$i++) { $charset = $elements[$i]->charset; $text =$elements[$i]->text; if(!strcasecmp($charset, "utf-8") || !strcasecmp($charset, "utf-7")) { $text = iconv($charset, "EUC-KR", $text); } $decoded = $decoded . $text; } return $decoded; } --was-- imap_mime_header_decode, utf-7 and utf-8 problem, i solved the problem using below function. note that iconv function for code converting. you must replace "EUC-KR" as iconv parameter with charset you want such as "iso-8859-1". function mime_decode($s) { $elements = imap_mime_header_decode($s); for($i = 0;$i < count($elements);$i++) { $charset = $elements[$i]->charset; $text =$elements[$i]->text; $text = iconv($charset, "EUC-KR", $text); $decoded = $decoded . $text; } return $decoded; } http://www.php.net/manual/en/function.imap-mime-header-decode.php

« previous php.notes (#41555) next »