如何将mongodb charset设置为utf8?

zor*_*064 15 database export utf-8 character-encoding mongodb

我是mongodb的新手.我需要在我的数据库中以utf8编码存储一些数据.当我导出它们或将它们看到控制台时,它们无法正确显示.我可以将我的数据库设置为utf8字符集来解决这个问题吗?如果是,我该怎么做?

sub*_*ing 10

BSON只能编码UTF-8.如果您的问题在于导出和控制台,则可能在将数据UTF-8上传到之前无法将数据转换为mongodb.

  • @Hector 查看 Python [howto 文章](https://docs.python.org/2/howto/unicode.html)。在字符串上,您可以使用encode()方法:u.encode('utf-8') (2认同)