关于json.dumps中的ensure_ascii
json
适用于现代 C++ 的 JSON。
项目地址:https://gitcode.com/gh_mirrors/js/json
·
在使用json.dumps时要注意一个问题
>>> import json
>>> print json.dumps('中国')
"\u4e2d\u56fd"
输出的会是
'中国' 中的ascii 字符码,而不是真正的中文。
这是因为json.dumps 序列化时对中文默认使用的ascii编码.想输出真正的中文需要指定ensure_ascii=False:
>>> import json
>>> print json.dumps('中国')
"\u4e2d\u56fd"
>>> print json.dumps('中国',ensure_ascii=False)
"中国"
>>>
转自:http://www.cnblogs.com/biangbiang/archive/2013/02/19/2916780.html
适用于现代 C++ 的 JSON。
最近提交(Master分支:5 个月前 )
3a570393
Bumps [cppcheck](https://github.com/msclock/cppcheck-wheel) from 1.4.8 to 1.5.0.
- [Release notes](https://github.com/msclock/cppcheck-wheel/releases)
- [Changelog](https://github.com/msclock/cppcheck-wheel/blob/master/.releaserc.js)
- [Commits](https://github.com/msclock/cppcheck-wheel/compare/v1.4.8...v1.5.0)
---
updated-dependencies:
- dependency-name: cppcheck
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 2 天前
4d216e0c
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.1 to 4.6.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1...ea165f8d65b6e75b540449e92b4886f43607fa02)
---
updated-dependencies:
- dependency-name: actions/upload-artifact
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 2 天前
更多推荐




所有评论(0)