views:

37

answers:

1

My setup is:

linux + Ruby 1.9 + rails 2.3.8 + mongodb + mongo_mapper

I followed http://railscasts.com/episodes/194-mongodb-and-mongomapper, that everything is OK first. I can insert English strings successfully, but when I insert some Chinese strings, it inserted, but can't be displayed.

The web page shows an exception:

invalid byte sequence in US-ASCII 

I use mongo command to see the data in mongodb, and it's correct. But I don't know why rails can't display them.

thanks in advance

A: 

After a lot of searchs, it seems there is a bug in Ruby 1.9 with UTF-8, and it's impossible for me to fix it.

Finally, I downgraded to ruby 1.8.7, and everything is OK now.

Freewind