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

后端 未结 2 1839
暗喜
暗喜 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:18

    I found this, much easier solution:

    Just add ENV['RUBYOPT'] = "-Ku" to your environment variables on Heroku. You can do this with figaro gem:

    1. Add gem "figaro" to your Gemfile
    2. bundle install
    3. Insert this code in config/application.yml:

      production:
        RUBYOPT: "-Ku"
      
    4. Run rake figaro:heroku

    Also, you can try with magic_encoding gem, but I dislike this approach.

提交回复
热议问题