在Python中使用 "\uxxxx".decode("unicode_escape") 1. class Helper_Tool { public static function unicodeDecode($data) { function replace_unicode_escape_sequence($match) { return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');…
# -*- coding:utf-8 -*- import sys,os txta = open('a.txt','r') str = '' for line in txta: str += line.strip().decode('utf-8') txta.close() for word in str: print word.encode('utf-8') 直接输出,是会乱码的,得先解码,再编码. 参考网址:http://blog.csdn.net/devil_2009/article/de…