bson.errors.InvalidStringData: strings in documents must be valid UTF-8
场景:
pymongo 查询数据库的时候报错。
for gscode in GSList_StockPool_Mongo_MktStop:
self._collection_flash.find({"ymd": nDateNow, "gscode": gscode}).count()
原因:
不是utf-8编码,gscode 取到的中文是乱码。
解决方法:
编码改为utf-8。
bson.errors.InvalidStringData: strings in documents must be valid UTF-8的更多相关文章
- python unicode字节串转成中文问题
如题,其实我的问题很简单,就是在写爬虫的时候拿到网页的信息包含类似“\u65b0\u6d6a\u5fae\u535a\u6ce8\u518c”的字符串,实际上这是unicode的中文编码,对应的中文为 ...
- MongoDB - Introduction to MongoDB, Documents
MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents, th ...
- abiword Related Pages
Application Framework The 'af' directory contains all source code for the cross-platform application ...
- go语言操作mongodb
Install the MongoDB Go Driver The MongoDB Go Driver is made up of several packages. If you are just ...
- nosql_action
ps -aux 查当前端口占用 connecting to: test > show dbs local .078125GB testphp .203125GB > use testph ...
- Python2.7.6标准库内建函数
Built-in Functions abs() divmod() input() open() staticmethod() all() enumerate() int() ord( ...
- 【GoLang】GO语言系列--002.GO语言基础
002.GO语言基础 1 参考资料 1.1 http://www.cnblogs.com/vimsk/archive/2012/11/03/2736179.html 1.2 https://githu ...
- ExtJS4笔记 Data
The data package is what loads and saves all of the data in your application and consists of 41 clas ...
- andriod 开发记录apidemos 错误解决
android sdk 里面有simple 文件夹里面有对应的demo 但是拿出来esplise运行报错 解决方案如下 右键错误代码goto,给对应错误的单引号前加 \ 原文http://stack ...
随机推荐
- 转:ASP.NET MVC 将IList<T>导出Excel文档的泛型类
/// <summary> /// 提供将泛型集合数据导出Excel文档. /// </summary> /// <typeparam name="T" ...
- ASP.NET Web API 中 特性路由(Attribute Routing) 的重名问题
刚才忘了说了,在控制器名重名的情况下,特性路由是不生效的.不然的话就可以利用特性路由解决同名的问题了. 而且这种不生效是真的不生效,不会提示任何错误,重名或者什么的,直接会报告404,所以也是个坑.
- NGUI UIPanel绘制原理学习
NGUI底层绘制都是调用UIDrawCall来完成的,它会动态实例化出材质球,改变UV偏移和缩放(图集显示).并且全部是面片 UIPanel也是面片,但是内部物体遮罩比较特殊,经过查找发现,影响UIP ...
- 斯坦福IOS开发第五课(第二部分)
转载请注明出处 http://blog.csdn.net/pony_maggie/article/details/27845257 作者:小马 五 代码演示样例 上面讲到的知识点在这个演示样例都有涉及 ...
- Linux下NDK的配置
vim ~/.bashrc 在文件末尾添加如图两行代码 写下来方便复制export NDKROOT=/usr/ndk/android-ndk-r12bexport PATH=$NDKROOT:$PAT ...
- 简单好用的hash表-----uthash
在软件开发中,不可不免的会使用到hash表,hash表的优点这里就不说了,以下介绍一个hash表的C实现, uthash是用宏实现的,使用的时候非常方便,只用包含uthash.h即可. Uthash的 ...
- Oracle中文字符乱码?设置Oracle客户端字符编码与服务端一致
经常可能出现查询Oracle数据时,中文显示乱码,这很可能是因为,Oracle服务端的字符编码与客户端不一致引起的. 这时,我们需要做的是,如何设置自己的客户端字符编码与服务端一致. 查询Oracle ...
- $.cookie is not a function;原因及解决办法
一.没有引入jQuery库文件 二.jQuery库文件和jquery.cookie.js文件的顺序问题.须先引入jQuery库文件再引入cookie插件文件 三.页面的加载顺序所导致 大家的问题大多出 ...
- JavaScript Array 对象方法
data.sort(function(a,b){return a.time>b.time?1:-1}); http://www.w3school.com.cn/jsref/jsref_obj_a ...
- 【转】雅典娜与宙斯的对话.(kerberos原理)
1 八月 2010 22:07:51关于Kerberos的对话(MIT)雅典娜与宙斯 雅典娜与宙斯关于地狱之门守护者的对话 Kerberos: Network Authentication Proto ...