# Incompatible character encodings

**URL:** <https://www.ruby-forum.com/t/incompatible-character-encodings/186453>\
**Category:** Rails\
**Created:** [April 7, 2010, 12:27pm UTC](https://www.ruby-forum.com/t/incompatible-character-encodings/186453 "2010-04-07T12:27:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 7, 2010, 12:27pm UTC](https://www.ruby-forum.com/t/incompatible-character-encodings/186453/1 "2010-04-07T12:27:00Z")

</div>

I am getting an error

incompatible character encodings: ASCII-8BIT and UTF-8

when I try to render a partial view for the children objects of a main  
object’s edit page.

This is the controller method :

def update  
@display\_treatment = [  
{“exam type”=\>“treatmenttype”} ,  
{“preparation comments”=\>“preparation”},  
{“preparation nature”=\>“natureprep”} ,  
{“reference cut”=\>“refCoupe”},  
{“author”=\>“author”},  
]

```
@echantillon = Echantillon.find(params[:id])
@treatments = Treatment.find(:all, :conditions => ['echantillon_id

```

= ?’, @echantillon.id])

```
respond_to do |format|
  if @echantillon.update_attributes(params[:echantillon])
    flash[:notice] = 'Echantillon was successfully updated.'
    format.html { redirect_to(@echantillon) }
    format.xml { head :ok }
  else
    format.html { render :action => "edit" }
    format.xml { render :xml => @echantillon.errors, :status

```

=\> :unprocessable\_entity }  
end  
end  
end

and this is in the edit view:

```
  <%= render :partial => 'treatmentupdate', :locals =>

```

{:treatments =\> @echantillon.treatments} %\>

and this is the partial:

\<% @i = 1 %\>  
\<% for treatment in @treatments %\>

## Traitement \<%= @i %\>

\<% fields\_for “echantillon[treatment\_attributes\_updates][]”,  
treatment do |treatment\_form|%\>  
\<% for c in @display\_treatment %\>

  
 \<%= c.first.first %\> : \<%=  
text\_field :treatment, c.first.second, :value =\>  
treatment[c.first.second] %\>  
  
  
\<% end %\>  

* * *
  
\<% end %\>  
\<% @i = @i + 1 %\>  
\<% end %\>

I am getting the error on this line:

```
   <td class ="name"> <%= c.first.first %> : </td><td></td><td><%=

```

text\_field :treatment, c.first.second, :value =\>  
treatment[c.first.second] %\>
