简体   繁体   中英

ArgumentError (invalid byte sequence in UTF-8): Ruby 1.9.3 render view

I have a problem when try to build one dropdown in view with rails

<div class='dropdown_menu'>
  <select id="venue_id" class="droppy" name="venue_id" onchange="submit();">
    <% @venues.each do |venue| %>
    <option value="<%= venue.id %>"<% if session[:venue] == venue.id %> selected<% end %>><%= venue.title %></option>
    <% end %>
  </select>
</div>

when build the option <%= venue.title %> I got a error

ArgumentError (invalid byte sequence in UTF-8):

I tried some solutions but do not work

For Fixed this, only used gem 'mysql2' and change adapter in my database.yml, and change the encoding

staging:
adapter: mysql2
database: data_basename
username: root
encoding: utf8

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM