Umlaute in selectbox

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]
]

It seems that my files must be in utf-8. I’ve set the charset of the
view to utf-8, so the umlaut in the prompt is displayed correctly.

The problem seems to be that rails can’t deal with models in utf-8
charset. I get a syntax error when I set the charset of
customer_adresse.rb to utf-8.

Any idea how to handle this?

Thanks
Luma

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs