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

bsoncxx::to_json() do not support GBK

    XMLWordPrintable

    Details

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

      Description

      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;
      }
      

        Attachments

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

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: