How to save double-byte characters in mongodb?

I have a Model called Review.rb

class MovieNews::Review
        include Mongoid::Document
        include Mongoid::Timestamps
        include Mongoid::Userstamp
        include Mongoid::Search

        field :story,   type: String

When i create a instance of class review and tried saving which local language telugu in the field, im getting wrong output.


review =
review.story = "నటవర్గం" after pasting here it's spelling goes worng "నటవర్.." => true

Does Mongodb supports local languages to create collection? Someone please help me out.

Are you saying that data saved to mongo comes back incorrect or that it’s the pasting in your text editor (or possibly the ruby console) that doesn’t work?


As Fred has indicated, is the issue that the string appears incorrectly in the terminal / editor, or that it is saved incorrectly to the database? I was able to produce a string that looks (to my thoroughly-unfamiliar-with-Telegu-script eyes) like your “spelling goes wrong” example by replacing the last six bytes of the string with two literal periods (codepoint U+2E).

–Matt Jones