场景:

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的更多相关文章

  1. python unicode字节串转成中文问题

    如题,其实我的问题很简单,就是在写爬虫的时候拿到网页的信息包含类似“\u65b0\u6d6a\u5fae\u535a\u6ce8\u518c”的字符串,实际上这是unicode的中文编码,对应的中文为 ...

  2. MongoDB - Introduction to MongoDB, Documents

    MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents, th ...

  3. abiword Related Pages

    Application Framework The 'af' directory contains all source code for the cross-platform application ...

  4. go语言操作mongodb

    Install the MongoDB Go Driver The MongoDB Go Driver is made up of several packages. If you are just ...

  5. nosql_action

    ps -aux  查当前端口占用 connecting to: test > show dbs local .078125GB testphp .203125GB > use testph ...

  6. Python2.7.6标准库内建函数

        Built-in Functions     abs() divmod() input() open() staticmethod() all() enumerate() int() ord( ...

  7. 【GoLang】GO语言系列--002.GO语言基础

    002.GO语言基础 1 参考资料 1.1 http://www.cnblogs.com/vimsk/archive/2012/11/03/2736179.html 1.2 https://githu ...

  8. ExtJS4笔记 Data

    The data package is what loads and saves all of the data in your application and consists of 41 clas ...

  9. andriod 开发记录apidemos 错误解决

    android sdk 里面有simple 文件夹里面有对应的demo  但是拿出来esplise运行报错 解决方案如下 右键错误代码goto,给对应错误的单引号前加 \ 原文http://stack ...

随机推荐

  1. spring 多线程

    http://blog.csdn.net/chszs/article/details/8219189 一.ThreadPoolTaskExecutor ThreadPoolTaskExecutor的配 ...

  2. echarts geo地图坐标转换为页面Offset坐标

    https://github.com/apache/incubator-echarts/issues/2540 代码示例: // 获取系列 ) // 获取地理坐标系实例 var coordSys = ...

  3. ActiveMQ + NodeJS + Stomp 入门

    NodeJS + stomp-client 入门 准备 下载ActiveMQ并安装 执行bin\win32\activemq.bat启动MQ服务 打开http://localhost:8161/adm ...

  4. 由于CentOS的系统安装了epel-release-latest-7.noarch.rpm 导致在使用yum命令时出现Error: xz compression not available问题

    由于CentOS6的系统安装了epel-release-latest-7.noarch.rpm 导致在使用yum命令时出现Error: xz compression not available问题.解 ...

  5. Spring Cloud构建微服务架构(三)断路器

    在分布式架构中,断路器模式的作用也是类似的,当某个服务单元发生故障(类似用电器发生短路)之后,通过断路器的故障监控(类似熔断保险丝),向调用方返回一个错误响应,而不是长时间的等待.这样就不会使得线程因 ...

  6. Java:HttpClient篇,HttpClient4.2在Java中的几则应用:Get、Post参数、Session(会话)保持、Proxy(代理服务器)设置,多线程设置...

    新版HttpClient4.2与之前的3.x版本有了很大变化,建议从http://hc.apache.org/处以得到最新的信息. 关于HttpCore与HttpClient:HttpCore是位于H ...

  7. android获取对话框文本注意事项

    1.View注意设置成final类型如final View layout=.. . 2.获取文本框对象时候格式EditText e = (EditText)layout.findViewById(R. ...

  8. 每日英语:Mooncake Austerity Hits China's Mid-Autumn Festival

    First baijiu, then red carpets, and now mooncakes. For Chinese government officials, the list of tab ...

  9. Oracle PLSQL Demo - 02.SELECT INTO单行赋值[SELECT INTO variables]

    declare v_sal number; begin ; dbms_output.put_line(v_sal); end;

  10. LeetCode: Integer to Roman 解题报告

    Integer to Roman Given an integer, convert it to a roman numeral. Input is guaranteed to be within t ...