I’ve got a form.select that takes the choices from an array in the
model customer_adresse. When I write “ü” and “ä” in the
prompt and the keys of the array, I see “ü” and “ä” in the
selectbox. When I simply write these characters, I get quadrat signs.
The signs have ascii codes 129 and 132.
I’ve set “encoding: utf8”, but actually, the database shouldn’t be
concerned with this problem.
As I’m using Rails 2.0, I think I don’t need to use
ActionController::Base.default_charset=(“UTF-8”)
I’m trying to use the parameter html_options, but nothing has
changed.
<% form_for :customer_adresse, :url => { :action
=> :save_adresse } do |form| %>
<%= form.select :bundesland, CustomerAdresse::BUNDESLAENDER,
options={:prompt => “Bitte wählen Sie aus”},
html_options={‘accept-charset’ => ‘utf-8’} %>
<% end %>
BUNDESLAENDER = [
# Displayed stored in db
[“Baden-Württemberg”, 1],
[“Bayern”, 2],
[“Berlin”, 3],
[“Brandenburg”, 4],
[“Bremen”, 5],
[“Hamburg”, 6],
[“Hessen”, 7],
[“Mecklenburg-Vorpommern”, 8],
[“Niedersachsen”, 9],
[“Nordrhein-Westfalen”, 10],
[“Rheinland-Pfalz”, 11],
[“Saarland”, 12],
[“Sachsen”, 13],
[“Sachsen-Anhalt”, 14],
[“Schleswig-Holstein”, 15],
[“Thüringen”, 16]
]