Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1652

bsoncxx::to_json() do not support GBK

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.0
    • Component/s: BSON
    • Environment:
      win10--x64-Debug mongocxx-driver-3.2.0

      New to MongoDB. I have already install mongocxx-driver-3.2.0 successfully in my PC. But when i run my code as follows, this error happened:
      the console outputs the invalid bson. What should i do to solve it?

      int main() {
      	bsoncxx::builder::stream::document stream_doc;
      	stream_doc << "_id" << 1 << "name" << open_document
      		<< "first" << "John" << "last" << "Backus" << close_document
      		<< "contribs" << open_array << "Fortran" << "AlGOL" << "Backus-Naur Form" << "FP" << close_array
      		<< "awards"
      		<< open_array
      		<< open_document
      		<< "award" << "W.W. McDowell Award"
      		<< "year" << 1967
      		<< "by" << "IEEE Computer Society"
      		<< close_document
      		<< open_document
      		<< "award" << "Draper Prize"
      		<< "year" << 1993
      		<< "by" << "你好"
      		<< close_document
      		<< close_array;
      
      	bsoncxx::document::view view = stream_doc.view();
      	std::cout << bsoncxx::to_json(view) << std::endl;
              return 0;
      }
      

        1. 2018-09-14_171126.png
          2018-09-14_171126.png
          6 kB
        2. Pic2.png
          Pic2.png
          20 kB

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            haijiwei haijiwei
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: