可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm acquiring the unread mails I have in my GMail account through PHP and its method imap_open
When I get the subjects through the method imap_fetch_overview I get some subjects like this:
=?ISO-8859-1?Q?Informaci=F3n_Apartamento_a_la_Venta?= =?ISO-8859-1?Q?_en_Benasque(Demandas:_0442_______)?=
It's unreadable, I think because of its character encoding.
What should I do to make it readable?
回答1:
To get the string in UTF-8, do:
$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));
which gives:
Información Apartamento a la Venta en Benasque(Demandas: 0442 )
You can then convert to ISO-8859-1, if you wish.
回答2:
$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));
it works for me (thanks artefacto)