Heroku and Rails: how to set utf-8 as the default encoding

后端 未结 2 1880
暗喜
暗喜 2021-01-19 16:44

Today, I created a copy of a working app, which runs perfectly on Heroku, and tried to deploy it on Heroku as a starting point for a new project.

I added the new fol

2条回答
  •  忘掉有多难
    2021-01-19 17:23

    In your config/application.rb,

      config.encoding = "utf-8"
    

    in the database.yml,

     development:
         adapter:  mysql2(whatever your db)
         host:     localhost
         encoding: utf8
    

    you also have to add(including the hash)

    # encoding: UTF-8
    

    source:http://craiccomputing.blogspot.com/2011/02/rails-utf-8-and-heroku.html

提交回复
热议问题