91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .py
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-22
  • 語言: Python
  • 標(biāo)簽: unic.py??

資源簡介

解決ride日志中文顯示為unicode編碼的問題

資源截圖

代碼片段和文件信息

#??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?????????????????????????????????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:
????????????????????pass
????????????except:
????????????????pass
????????try:
????????????try:
????????????????return?unicode(item)
???????

評論

共有 條評論

相關(guān)資源