rails guide blog练习报错incompatible character encodings: ASCII-8BIT and UTF-8

Make sureconfig.encoding = "utf-8"is in the application.rb file.

Make sure you are using the 'mysql2' gem.

Put# encoding: utf-8at the top of file containing UTF-8characters.

Above the<App Name>::Application.initialize!line in the environment.rb file, addfollowing two lines:

Encoding.default_external= Encoding::UTF_8

Encoding.default_internal= Encoding::UTF_8

设置了红色字体的就好用了

你可能感兴趣的:(Web,报错,Rails)