ruby on rails - ActionView::Template::Error (Your template was not saved as valid utf-8 -


i writing first ruby on rails program following this guide

now have created first form mentioned in section - 5.2 first form

my form looks this:

# encoding: utf-8  <%= form_for :article |f| %>   <p>     <%= f.label :title %><br>     <%= f.text_field :title %>   </p>    <p>     <%= f.label :text %><br>     <%= f.text_area :text %>   </p>    <p>     <%= f.submit %>   </p> <% end %> 

now when try load page accessing url - http://localhost:3000/articles/new, error as:

we're sorry, went wrong.

the logs this:

  rendered articles/new.html.erb within layouts/application (0.0ms) completed 500 internal server error in 0ms  actionview::template::error (your template not saved valid utf-8. please either specify utf-8 encoding template in text editor, or mark template encoding in serting following first line of template:  # encoding: <name of correct encoding>. 

so have encoding set first line of page, still getting same error. please tell me mistake here?

update:

i tried setting encoding using below line:

<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 

but still getting same issue.

to summarize, have done fix issue per comments given marek lipka.

just modified encoding in editor utf-8. using notepad++ in windows 8. form now:

<h1>new article</h1> <%= form_for :article |f| %>   <p>     <%= f.label :title %><br>     <%= f.text_field :title %>   </p>    <p>     <%= f.label :text %><br>     <%= f.text_area :text %>   </p>    <p>     <%= f.submit %>   </p> <% end %> 

Comments