ruby - Sinatra Mongoid String not valid UTF-8 -
i wrote little application :
require 'rubygems' require 'sinatra' require 'bson' require 'mongoid' mongoid.configure |config| name = "articles" host = "localhost" config.master = mongo::connection.new.db(name) config.persist_in_safe_mode = false end class article include mongoid::document field :title field :content end '/' @articles = article.all end '/show/:id' @article = article.find(params[:id]) end '/new' haml :new end post '/create' @article = article.new(params['article']) if @article.save redirect '/' else redirect '/new' end end
the following error occur when post article content "test d'un article en français"
bson::invalidstringencoding @ /create string not valid utf-8
how can fix error ?
thanks
this known issue ruby 1.9 , sinatra. wait sinatra 1.1 released or use sinatra edge version github.
Comments
Post a Comment