代码之家  ›  专栏  ›  技术社区  ›  David Morales

=?ISO-8859-1邮件主题

  •  5
  • David Morales  · 技术社区  · 14 年前

    我正在通过php及其方法获取gmail帐户中的未读邮件 极开

    当我通过这个方法得到这些主题时 imap_fetch_概述 我有一些这样的主题:

    =?ISO-8859-1?Q?Informaci=F3n_Apartamento_a_la_Venta?= =?ISO-8859-1?Q?_en_Benasque(Demandas:_0442_______)?=
    

    它不可读,我想是因为它的字符编码。

    我该怎么做才能让它可读?

    2 回复  |  直到 9 年前
        1
  •  12
  •   Artefacto    14 年前

    要获取UTF-8格式的字符串,请执行以下操作:

    $or = '=?ISO-8859-1?Q?Informaci=F3n_Apartamento_a_la_Venta?= =?ISO-8859-1?Q?_en_Benasque(Demandas:_0442_______)?=';
    mb_internal_encoding('UTF-8');
    $v = str_replace("_"," ", mb_decode_mimeheader($or));
    

    它给出:

    Información Apartamento a la Venta en Benasque(Demandas: 0442       )
    

    那么你就可以 convert 如您愿意,请发送至ISO-8859-1。

        2
  •  -1
  •   Sportivivi    9 年前
    $or = '=?ISO-8859-1?Q?Informaci=F3n_Apartamento_a_la_Venta?= =?ISO-8859-1?Q?_en_Benasque(Demandas:_0442_______)?=';
    mb_internal_encoding('UTF-8');
    $v = str_replace("_"," ", mb_decode_mimeheader($or));
    

    它对我有效(谢谢阿泰菲)