更新时间:2022-12-22 15:04:14
根据Heroku支持人员,这是神奇的东西:
As per the Heroku support staff, this is the magic thing:
heroku config:add LANG=en_US.UTF-8
尽管 heroku控制台
将继续报告字符串编码为
ASCII-8BIT
,您的实际应用将使用正确的编码运行,基于 LANG
config var。
您可以通过这样做来加倍检查:
Although heroku console
will keep reporting strings encoding as ASCII-8BIT
, your actuall app will be running with the correct encoding, based on the LANG
config var.
You can double check that by doing this:
$ heroku run bash
Running bash attached to terminal... up, run.2
u20415@022e95bf-3ab6-4291-97b1-741f95e7fbda:/app$ irb
irb(main):001:0> "a".encoding
=> #<Encoding:UTF-8>