dongzanghua8422 2011-06-28 09:31
浏览 35

从IMAP电子邮件正文中读取日文字符

i try to fetch the body of the email in japanese with this code:

header('Content-Type: text/html;charset=utf-8');  
$mbox = imap_open ("{localhost:995/pop3/ssl/novalidate-cert}",        "***@*****.com", "*******");
$email="something@something.com";
$num_mensaje = imap_search($mbox,"FROM $email");
$body =  imap_fetchbody($mbox,$num_mensaje[0],"1");

echo imap_8bit($body));

but doesn't work for me i see this *$B$3$s$K$A$O!"$=$N$h$&$J

any ideas

Thanks in advance

  • 写回答

2条回答 默认 最新

  • duanjiushu5063 2011-06-28 10:33
    关注

    Since <ESC>$B is one of the primary control sequences in the JIS encodings, and your output begins *$B, it would appear that your data has come from that source. Try using mb_convert_encoding from JIS (or SJIS).

    Edit: If you are potentially accepting Japanese from multiple encodings, you could look at the mb_detect_encoding function; making use of an appropriate encoding list.

    评论

报告相同问题?

悬赏问题

  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 vue3加ant-design-vue无法渲染出页面
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏