erbでincompatible
character encodingsが出たときの対処(encoding UTF-8を入れる)
環境
- erbを素で使っている(Ruby on Railsは使っていない)
Before
AUTHOR = '結城浩'
AUTHOR_YOMI = 'ゆうき・ひろし'
...
<%
load 'common/author.rb'
COLOR_PRIMARY = '#559fbf'
URL = 'http://girl1.hyuki.net/'
...
%>
...
Error
$ erb index.erb > index.html
... in `concat': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)
After
# encoding: UTF-8
AUTHOR = '結城浩'
AUTHOR_YOMI = 'ゆうき・ひろし'
...
<%# encoding: UTF-8 %>
<%
load 'common/author.rb'
COLOR_PRIMARY = '#559fbf'
URL = 'http://girl1.hyuki.net/'
...
%>
...
関連