基于RF3.0修改:
找到robot/utils/unic.py
增加导入模块
import json
修改unic函数,红色部分为新增的代码
if PY2: def unic(item): if isinstance(item, unicode): return item if isinstance(item, (bytes, bytearray)): try: return item.decode('ASCII') except UnicodeError: return u''.join(chr(b) if b < 128 else '\\x%x' % b for b in bytearray(item)) if isinstance(item, (list, dict, tuple)): try: item = json.dumps(item, ensure_ascii=False, encoding='utf-8') except UnicodeDecodeError: try: item = json.dumps(item, ensure_ascii=False, encoding='gbk') except UnicodeDecodeError: pass try: try: return unicode(item) except UnicodeError: return unic(str(item)) except: return _unrepresentable_object(item) else: def unic(item): if isinstance(item, str): return item if isinstance(item, (bytes, bytearray)): try: return item.decode('ASCII') except UnicodeError: return ''.join(chr(b) if b < 128 else '\\x%x' % b for b in item) try: return str(item) except: return _unrepresentable_object(item)
修改后正确显示中文