# Umlaute in selectbox

**URL:** <https://www.ruby-forum.com/t/umlaute-in-selectbox/112337>\
**Category:** Rails\
**Created:** [August 17, 2007, 5:42pm UTC](https://www.ruby-forum.com/t/umlaute-in-selectbox/112337 "2007-08-17T17:42:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/d6d6ee/32.png) [@luma](https://www.ruby-forum.com/u/luma)\
**Post date:** [August 17, 2007, 5:42pm UTC](https://www.ruby-forum.com/t/umlaute-in-selectbox/112337/1 "2007-08-17T17:42:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![luma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/d6d6ee/32.png) [@luma](https://www.ruby-forum.com/u/luma)\
**Post date:** [August 17, 2007, 7:59pm UTC](https://www.ruby-forum.com/t/umlaute-in-selectbox/112337/2 "2007-08-17T19:59:23Z")

</div>

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
