display utf 8 characters in text fields in edit page

I have no problems displaying data from my database with characters like é à è etc. anywhere in my application; however on my edit page, when it tries to display the data in the text fields I get incompatible character encoding errors. Any ideas?

<% for c in @attribute_columns do %>   <%= f.text_field c.second %>

What version of Rails are you running?

Mikel

I'm running Rails 2.3.5

I have still not found a solution to this. Does anyone have an idea?

I think it could be browser issue. Check your addons in your browsers or try different clean browsers to see the issue occurring.

Maybe desktop has been configured to ascii language editor. Try in a different computer.

Make sure that Database columns are utf8 compatible in the database. database.yml should contain encoding: utf8

It works if I write this as the value for the text field:

value="<%= @echantillon['material'].force_encoding('UTF-8') %> "

Which means that when it is doing the SELECT from the database, it is not selecting it in UTF-8. How can I force it to do selects in UTF-8?

you dont need to do this, if your setup is correct.

ES wrote:

It works if I write this as the value for the text field:

value="<%= @echantillon['material'].force_encoding('UTF-8') %> "

Which means that when it is doing the SELECT from the database, it is not selecting it in UTF-8. How can I force it to do selects in UTF-8?

Is the database using UTF-8? Is Rails connecting to it with UTF-8 encoding? Is UTF-8 encoding specified in your page headers?

Best,