Question

This is a strange bit, When I run localhost:3000 it prompts me with error listed below

Encoding::CompatibilityError in Home#index

incompatible character encodings: Windows-1252 and UTF-8

17: <%= render 'layouts/header'%>
18:
19: <%= yield %>
20: <%= render 'layouts/footer' %>
21: </body>
22: </html>

but it renders other pages if I do localhost:3000/en/#actionName.

Since, localhost:3000 renders the index.html.erb, only for testing purposes I deleted the contents of index.html.erb; it rendered the layouts. So, what is wrong with the content of the index.html.erb page? everything looks okay to me, also I downloaded the content of index.html.erb from the server (the working version) it still gives me the same error. Need some guidance where I could have gone wrong. I tried the solution mentioned in this link Ruby on Rails 3, incompatible character encodings: UTF-8 and ASCII-8BIT with i18n but with no luck at all.

Thanks in advance.

            =====================  **UPDATE** ======================

why it did that it has been listed below: However another question pops in, why adding those source code generate such errors only for index.html.erb.

Was it helpful?

Solution

i have figured out the issue, the problem was i added the following source code listed below in (app/view/layouts/) _footer.html.erb

<p style="float:left;text-align:none;padding:0px;font-size:8px;font-stretch:6px; ">
    <select name="language" onchange="location=this.options[this.selectedIndex].value;"   autocomplete="off">
        <option value=""></option>
        <option value="/en/faq">english</option>
        <option value="/es/faq">español</option>
        <option value="/de/faq">germany</option>
        <option value="/fr/faq">french</option>
        <option value="/it/faq">italy</option>
    </select>
</p>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top