[python-chinese] 如何匹配网络数据流中的utf8字符串?

Kevin Rong kevin.rong在gmail.com
星期六 九月 2 06:39:12 HKT 2006


解决了。不用struct.unpack.直接判断utf8的范围,然后print 这个范围的字符.decode('utf8')就能看见汉字

2006/9/1, helium <helium.sun在gmail.com>:
> unpack成字符串然后decode('utf-8')?
>
>
> 2006/9/1, Kevin Rong <kevin.rong在gmail.com>:
> > 大家好。
> > 最近用pcap玩起了sniffer,现在有个需求,想把网络包中的utf8字符给剥离出来。
> > 大家有谁这样做过,是用struct.unpack吗?
> > 我用struct.unpack('>\W+',recv_data) 能匹配一些很像是utf8的字符,可是怎么不能显示为汉字。
> > 有什么建议吗?
> > 谢谢!
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese


关于邮件列表 python-chinese 的更多信息