一个超难的问题,golang中,怎么把形式为ascii码的中文,转换为对应内码的中文啊?

坚慧 发布于 2014/11/12 17:04
阅读 505
收藏 0
PHP

有个apache的日志文件log.tx,里面有一段是中文文件名,下面红字的部分。。

2013-09-01 10:05:53|zhangyc_site_tag|200|application/pdf|attachment;filename=\xb6\xd4\xb6\xc0\xc1\xa2\xd1\xa7\xd4\xba\xbf\xc9\xb3\xd6\xd0\xf8\xb7\xa2\xd5\xb9\xce\xca\xcc\xe2\xb5\xc4\xcb\xbc\xbf\xbc__\xca\xa1\xc2\xd4_\xd1\xa7\xd4\xba_\xc1\xbd\xb8\xf6\xb6\xd3\xce\xe9_\xbd\xa8\xc9\xe8\xce\xca\xcc\xe2\xbd\xf8\xd0\xd0\xb7\xd6\xce\xf6_\xc8\xce\xba\xea\xcf\xbc.pdf|-|549240|-|549240|10.192.9.164|pdf.d.cnki.net.j.niit.edu.cn|:80|/cjfdsearch/pdfdownloadnew.asp?encode=gb&nettype=cnet&zt=H131&filename=ke3VzVa9UYOdzM1smZkhnSn52TllkS6Z1KxQmdtNmUZp2a1RTUHREZ5N2a1gmSEllMLpHNYlDVu5ETRdDRYl2d3MHM0h0MBdWdHZVakNFeuV1b=0zZL52KqJ2KDxUVv8WZutidGpERHtmZhBFS2YTNU5kMs1WYzYURo9kYwQ3U2cTezMHeIB1LIFjNSpmTzIUW1MzLNdXUOx2UJNWaYNUUoFzMG9&doi=CNKI:SUN:GLXZ.0.2013-08-060&m=2a1gmSEllMLpHNYlDVu5ETRdDRYl2d3MHM0h0MBdWdHZVakNFeuV1b=0TPnZ2K1J3YtlEUWlDNRlGR3lDa2EWUwQmdtNmUZp2a1RTUHREZ5N&u=bIfa2a&filetitle=%b6%d4%b6%c0%c1%a2%d1%a7%d4%ba%bf%c9%b3%d6%d0%f8%b7%a2%d5%b9%ce%ca%cc%e2%b5%c4%cb%bc%bf%bc__%ca%a1%c2%d4_%d1%a7%d4%ba_%c1%bd%b8%f6%b6%d3%ce%e9_%bd%a8%c9%e8%ce%ca%cc%e2%bd%f8%d0%d0%b7%d6%ce%f6_%c8%ce%ba%ea%cf%bc&p=CJFQ&cflag=&pager=108-109|http://www.cnki.net/KCMS/detail/detail.aspx?QueryID=2&CurRec=27&recid=&filename=GLXZ201308060&dbname=CJFDLAST2013&dbcode=CJFQ&pr=&urlid=&yx=&uid=WEEvREcwSlJHSldSdnQ0TWdpVk9YK0poMHhaYzR3a1dxc0tvUnBhZGprNFhJeG16dVdzTGZJTmd0MGw2b3QwPQ==&v=MjI3MjVMbWZidVp1Rnlua1Y3L0JJaUhUZExHNEg5TE1wNDlEWklSOGVYMUx1eFlTN0RoMVQzcVRyV00xRnJDVVI=|10.192.9.164|Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MALN; Media Center PC 6.0; .NET4.0C; .NET CLR 1.1.4322; BRI/2)|200|10.192.9.164|10.192.13.152.1371432851789484

用PHP,可以简单的eval一下,就可以得到中文名了,

eval("\$str = \"".$str."\";" );
echo $str;



请教各位大侠,go语言中这个怎么处理啊?

加载中
返回顶部
顶部