问题:RobotFramework在win10跑用例过程中有中文日志会显示非中文,如截图:

解决:

 C:\Python27\Lib\site-packages\robot\utils\unic.py ,用该文件内容替换:
#  Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License. from pprint import PrettyPrinter from .platform import IRONPYTHON, JYTHON, PY2
from .robottypes import is_bytes, is_unicode
import json 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='cp936')
except UnicodeDecodeError:
try:
item = json.dumps(item,ensure_ascii=False,encoding='cp936')
except:
pass
except:
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) # JVM and .NET seem to handle Unicode normalization automatically. Importing
# unicodedata on Jython also takes some time so it's better to avoid it.
if not (JYTHON or IRONPYTHON): from unicodedata import normalize
_unic = unic def unic(item):
return normalize('NFC', _unic(item)) def prepr(item, width=400):
return unic(PrettyRepr(width=width).pformat(item)) class PrettyRepr(PrettyPrinter): def format(self, object, context, maxlevels, level):
try:
if is_unicode(object):
return repr(object).lstrip('u'), True, False
if is_bytes(object):
return 'b' + repr(object).lstrip('b'), True, False
return PrettyPrinter.format(self, object, context, maxlevels, level)
except:
return _unrepresentable_object(object), True, False def _unrepresentable_object(item):
from .error import get_error_message
return u"<Unrepresentable object %s. Error: %s>" \
% (item.__class__.__name__, get_error_message())

RF:win10跑用例过程中有中文日志会显示非中文的更多相关文章

  1. JDK13.0.1安装与环境变量的配置(Win10平台为例)

    一.下载与安装 Oracle官网下载:https://www.oracle.com/technetwork/java/javase/downloads/index.html,点击右侧下载 接受并下载对 ...

  2. WiFi无线连接过程中有哪几个主要步骤?

    WiFi无线连接过程中有哪几个主要步骤?[1]在使用WIFI功能时,经常性的操作是打开手机上的WiFi设备,搜索到心目中的热点,输入密码,联网成功,成功上网.这个看似简单的过程,背后却是隐藏着大量的无 ...

  3. python matplotlib plot 数据中的中文无法正常显示的解决办法

    转发自:http://blog.csdn.net/laoyaotask/article/details/22117745?utm_source=tuicool python matplotlib pl ...

  4. 【原创】python中文编码问题深入分析(二):print打印中文异常及显示乱码问题分析与解决

    在学习python以及在使用python进行项目开发的过程中,经常会使用print语句打印一些调试信息,这些调试信息中往往会包含中文,如果你使用python版本是python2.7,或许你也会遇到和我 ...

  5. Android实现中文汉字笔划(笔画)、中文拼音排序、英文排序

    发布时间:2018-11-16   技术:Android   概述 最近要做一个类似微信的,在登录界面选择国家地区的功能,微信有中文汉字笔画排序以及中文拼音排序等几种方式,如下所示: 简体中文 拼音排 ...

  6. ELKF-分布式日志收集分析平台搭建 最小化 配置过程 - 查看收集日志(windows10下搭建)

    前言 Elasticsearch是与名为Logstash的数据收集和日志解析引擎以及名为Kibana的分析和可视化平台一起开发的.这三个产品被设计成一个集成解决方案,称为“Elastic Stack” ...

  7. C语言重定向输入:txt文件内容是中文,重定向输入显示乱码的原因

    一.txt文件中的内容是中文,重定向输入显示乱码原因: 是因为文本文件的编码和和编译器的不一致导致的.我文本文件用的编码是UTF-8,而编译器是ANSI,不匹配,所以输出乱码.文本另存为时把编码改为A ...

  8. Windows server 2012 添加中文语言包(英文转为中文)(离线)

    Windows server 2012 添加中文语言包(英文转为中文)(离线) 相关资料: 公司环境:亚马孙aws虚拟机 英文版Windows2012 中文SQL Server2012安装包,需要安装 ...

  9. JFreechart在linux下不显示及中文乱码问题

    一.使用JFreeChart建的报表,在window下能正常显示,但是放到linux下就报错,而且有时候会把tomcat挂掉, 原因是jfreechart的在linux系统中需要访问java awt库 ...

随机推荐

  1. 兄弟连学python---Socket介绍

    UDP协议 UDP:用户数据报协议,不可靠性,只是把应用程序传给IP层数据报送出去,但是不能保证他们是否能到达目的地,传输数据报钱不用再客户端和服务器之间建立连接,并且没有超时重发机制,所以传输速度快 ...

  2. word2007无法打开.doc

    如果您的WORD2007无法打开.DOC文档,可以试试如下的方法 打开注册表编辑器(开始-运行-输入regedit VISTA中在开始菜单最下方的搜索栏内输入regedit) 展开HKEY_CLASS ...

  3. maya权重拷贝一对一,一对多

    是不是有时候盔甲很多很碎头很大,用代理一个个拷贝很麻烦吧 用下面代码直接运行进行一对多或者一对一拷贝 第一个先选择参考物体,加选其他一堆有的没的有权重或没权重的物体执行一键拷贝,就可以啦 以下是源码送 ...

  4. github/gitee使用办法2

    打开自己的仓库 git pull 把内容复制过去 git add . 添加所有 查看状态 git status 提交 git commit -m 'XXX' 最后push git push 如果内容本 ...

  5. 采用CAS算法 实现高性能的Disruptor 完成多线程下并发、等待、先后等操作

    来源:https://blog.csdn.net/tianyaleixiaowu/article/details/79787377 拓展: https://www.jianshu.com/p/d24b ...

  6. 网页真机调试之Browsersync简介

    以前的调试方式 修改完项目文件(html.js.css等)后保存,在浏览器刷新页面查看修改后的效果 本地开启一个 tomcat 服务,修改文件后保存刷新页面,移动端或其他 pc 则需要输入 ip + ...

  7. HNOI2006公路修建问题

    https://www.luogu.org/problemnew/show/P2323 [题目描述] OI island是一个非常漂亮的岛屿,自开发以来,到这儿来旅游的人很多.然而,由于该岛屿刚刚开发 ...

  8. Xshell5一打开就提示要使用该程序,请更新至最新版本

    网上有两种方法 方法一:临时 修改系统时间,修改为一年前的时间即可.但是你会发现修改回当前时间后,xshell又打不开了 方法二:替换xshell文件 找到xshell安装位置,如果是快捷方式,可以右 ...

  9. 19.2 MEMORY CONTROLLER

    在存储控制器的BANKCONTROLREGISTER(BANKCONn: GCS6-nGCS7)表中:中文翻译各个寄存器的位出现错误: 原文中正确的表述见下图:

  10. postgresql 游标,函数,存储过程使用例子

    CREATE OR REPLACE FUNCTION cursor_demo() RETURNS refcursor AS --返回一个游标 $BODY$ declare --定义变量及游标 unbo ...