(PHP 4, PHP 5, PHP 7)

imap_qprintConvertit une chaîne à guillemets en une chaîne à 8 bits


imap_qprint ( string $string ) : string

Convertit la chaîne à guillemets string en une chaîne à 8 bits (selon la » RFC2045, section 6.7).

Liste de paramètres


Une chaîne à guillemets

Valeurs de retour

Retourne une chaîne de caractères à 8 bits.

Voir aussi

  • imap_8bit() - Convertit une chaîne à 8 bits en une chaîne encodée en Quoted-Printable

add a note add a note

User Contributed Notes 4 notes

bernard at bmpsystems dot com
20 years ago
This function seems to have a bug, when the quoted-printable string contains a "=" without the HEX code of a Character.
I use the regular quoted_printable_decode instead.
tonitester at gmx dot net
13 years ago
If you don't have access to the imap_qprint function and you have to encode URL Decoded and Quoted Printable Strings you receive by Mail try this simple function. But if you don't receive URL Decoded data and the string doesn't contain an = you better use

function decode_qprint($str){
$arr= array("A","B","C","D","E","F");
while (list(, $var) = each($arr)) {   
    while ($i <=9){
    $arr2 = array("A","B","C","D","E","F");
    while (list(, $val) = each($arr2)) {
$str = urldecode($str);
$str = utf8_encode($str);
return $str;}


$output = decode_qprint($s2d);
$output2 = decode_qprint($2s2d);

echo $output;
echo $output2;
bletous at yahoo dot fr
14 years ago
Some mails are encoded in bad quoted printable format:
I use this function to decode the qprint:


function decode($data,$code)

if(!$code){return imap_utf7_decode($data);}
if($code==0){return imap_utf7_decode($data);}
if($code==1){return imap_utf8($data);}
if($code==2){return ($data);}
if($code==3){return imap_base64($data);}
if($code==4){return imap_qprint(str_replace($myqprinta,$myqprintb,($data)));}
if($code==5){return ($data);}

wese at gmx dot at
11 years ago
I just got rid of the loops using a regex.

function decode_qprint($str) {
$str = preg_replace("/\=([A-F][A-F0-9])/","%$1",$str);
$str = urldecode($str);
$str = utf8_encode($str);

Thanks for sharing!
To Top