扩展RF,解决打印的日志信息中出现\xad\xfs\xff\xaa这样的字符

时间:2015-02-11 23:16:48   收藏:0   阅读:594

找到robot/utils/unic.py,修改_unic函数

def _unic(item, *args):
    try:
        return unicode(item, *args)
    except UnicodeError:
        try:
            return str(item).decode("UTF-8")
        except UnicodeError:
            try:
                return str(item).decode("GBK")
            except UnicodeError:
                try:
                    ascii_text = str(item).encode(string_escape)
                except:
                    return _unrepresentable_object(item)
                else:
                    return unicode(ascii_text)
    except:
        return _unrepresentable_object(item)

 

原文:http://www.cnblogs.com/njdoit/p/4287039.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!