Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving Chinese to mongodb 2.4.8 cause unreadable string

Before I used Mongodb 2.0.6, everything is fine. recently I started to use Mongodb 2.4.8 with Java Play framework, and I found that when I tried to save Chinese to mongodb, mongodb actually stored as some unreadable string, such as &\#21457;&\#29983;, what is show on web is the same string, does anything know why?

what should I do? how to convert it to readable Chinese?

like image 415
disorderdev Avatar asked Dec 03 '13 06:12

disorderdev


1 Answers

I think,your string gets converted to unreadable string in between.As I tested this on console and works fine for me.

 $ mongo test
 MongoDB shell version: 2.4.8
 connecting to: test
 > var doc = { "message" :"你好" }
 > db.ChineseWord.save(doc)
 > db.ChineseWord.find().pretty()
 { "_id" : ObjectId("529da2018170273efa43e181"), "message" : "你好" }
like image 112
deepakmodak Avatar answered Sep 26 '22 17:09

deepakmodak