ES1
(ES)
April 14, 2010, 9:58am
1
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 %>
Mikel1
(Mikel)
April 14, 2010, 12:34pm
2
What version of Rails are you running?
Mikel
ES1
(ES)
April 21, 2010, 8:40am
4
I have still not found a solution to this. Does anyone have an idea?
Amala_Singh
(Amala "தமிழ்" Singh)
April 21, 2010, 8:52am
5
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
ES1
(ES)
April 22, 2010, 5:08pm
6
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?
Amala_Singh
(Amala "தமிழ்" Singh)
April 22, 2010, 5:10pm
7
you dont need to do this, if your setup is correct.
11155
(-- --)
April 22, 2010, 9:59pm
8
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,