search

Home  >  Q&A  >  body text

python3.x - mongodb cannot display Chinese characters, they are all boxes. How to solve it?

Using pycharm IDE, paired with mongodb Explorer, the data is captured and stored in mongodb, but all Chinese characters cannot be displayed, they are all squares. . . I googled and found no similar issues. . Please help me, thank you very much!

黄舟黄舟2773 days ago702

reply all(2)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:25:56

    You first output the data to the console to see what it looks like, and then see what encoding your data is.
    Check the encoding like this

    import chardet
    test ="xxx"
    print chardet.detect(test)
    

    You should check the encoding of the title in your question before putting it into mongodb.

    reply
    0
  • 高洛峰

    高洛峰2017-05-02 09:25:56

    Do you see garbled characters in the mongo Shell?

    reply
    0
  • Cancelreply