Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codec error #36

Closed
beef9999 opened this issue Mar 7, 2015 · 3 comments
Closed

codec error #36

beef9999 opened this issue Mar 7, 2015 · 3 comments

Comments

@beef9999
Copy link

beef9999 commented Mar 7, 2015

a

{'body': '\xe6\xb4\xbb\xe5\x8a\xa8\xe8\xae\xa2\xe5\x8d\x95', 'mch_id': '10075693', 'out_trade_no': 'iT201ac2FuqnlLpgq0rtM74mh8MCL81b', 'total_fee': 888, 'appid': 'wxb16fc7aa939867f6', 'notify_url': 'http://wagon.cn/place_order_success', 'spbill_create_ip': '0.0.0.0', 'nonce_str': 'gxA4XI1gMAALItAHQlzaUoNIE4xCYA8N', 'trade_type': 'JSAPI', 'sign': '2D2BF7CD5263D1113E1AB5601059AF82'}

dicttoxml.dicttoxml(a)

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/dicttoxml.py", line 257, in dicttoxml
addline('<%s>%s</%s>' % (custom_root, convert(obj, ids, attr_type, parent=custom_root), custom_root))
File "/usr/local/lib/python2.7/dist-packages/dicttoxml.py", line 134, in convert
return convert_dict(obj, ids, parent, attr_type)
File "/usr/local/lib/python2.7/dist-packages/dicttoxml.py", line 145, in convert_dict
LOG.info('Looping inside convert_dict(): key="%s", val="%s", type(val)="%s"' % (key, val, type(val).name))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)

@quandyfactory
Copy link
Owner

Thanks for raising this issue. I will try to fix it later today.

@beef9999
Copy link
Author

beef9999 commented Mar 9, 2015

A little curious about the failing reason? Could you let me know what caused this error?

发自我的 iPhone

在 2015年3月9日,19:27,Ryan McGreal notifications@github.com 写道:

Thanks for raising this issue. I will try to fix it later today.


Reply to this email directly or view it on GitHub.

@quandyfactory
Copy link
Owner

Issue is fixed in version 1.6.4. The problem was a UnicodeDecodeError in the logging function when the module encountered the non-ASCII string in the body key. I had to write a function, unicode_me(), to support both Python 2.x and Python 3. Thanks again for reporting this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants