python3.x - mongodb 显示不出中文,都是方块,该如何解决?
黄舟
黄舟 2017-05-02 09:23:56
0
2
670

使用pycharm IDE,搭配mongodb Explorer,抓取数据存放至mongodb中,但是中文全部显示不出来,都是方块。。。google了一下没有类似问题。。请大牛帮帮忙,不胜感激!

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
给我你的怀抱

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.

小葫芦

Do you see garbled characters in the mongo Shell?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!