# RoR Problems with special Character in the model

**URL:** <https://www.ruby-forum.com/t/ror-problems-with-special-character-in-the-model/106362>\
**Category:** Ruby\
**Created:** [June 9, 2007, 12:51am UTC](https://www.ruby-forum.com/t/ror-problems-with-special-character-in-the-model/106362 "2007-06-09T00:51:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joachim\_Reichel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@Joachim\_Reichel](https://www.ruby-forum.com/u/Joachim_Reichel)\
**Post date:** [June 9, 2007, 12:51am UTC](https://www.ruby-forum.com/t/ror-problems-with-special-character-in-the-model/106362/1 "2007-06-09T00:51:37Z")

</div>

Hi all,

after two hours of googling I’ll ask you 😉

I have an ActiveRecord class which I extended with a method that returns  
an array of strings as categories.  
One string has a special character in it.  
When the class is used there is an error:  
parse error, unexpected tCONSTANT, expecting ‘]’

When the special character is removed or replaced by ue everything works  
fine.

Part of the code:

def rubriken  
rubriken=  
[  
[“Grundstücke”,“Grundstücke”]  
]  
end

The source file itself is encoded in utf-8.

Any ideas ?

---

<div class="post-metadata">

**Author:** ![Joachim\_Reichel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@Joachim\_Reichel](https://www.ruby-forum.com/u/Joachim_Reichel)\
**Post date:** [June 9, 2007, 1:21am UTC](https://www.ruby-forum.com/t/ror-problems-with-special-character-in-the-model/106362/2 "2007-06-09T01:21:40Z")

</div>

Joachim Reichel wrote:

> When the special character is removed or replaced by ue everything works
> 
> The source file itself is encoded in utf-8.
> 
> Any ideas ?

Have you tried using “Grundst\232cke” instead of “Grundstücke”?

---

<div class="post-metadata">

**Author:** ![Joachim\_Reichel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@Joachim\_Reichel](https://www.ruby-forum.com/u/Joachim_Reichel)\
**Post date:** [June 9, 2007, 1:35am UTC](https://www.ruby-forum.com/t/ror-problems-with-special-character-in-the-model/106362/3 "2007-06-09T01:35:41Z")

</div>

Michael,  
I did it with \u00F6 and after your post with \232 instead of the  
ü.The code runs then, but in the select box in the view file there is an ?  
shown. The view rhtml has a metatag requesting utf-8.

---

<div class="post-metadata">

**Author:** ![Joachim\_Reichel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@Joachim\_Reichel](https://www.ruby-forum.com/u/Joachim_Reichel)\
**Post date:** [June 9, 2007, 4:56pm UTC](https://www.ruby-forum.com/t/ror-problems-with-special-character-in-the-model/106362/4 "2007-06-09T16:56:12Z")

</div>

Zouplaz schrieb:

> You should triple check that - Because I had the same problem and the  
> files was not utf-8 encoded (windows cp something instead)…

First of: feels good not to be the only one with such a annoying  
problem.

After I read your reply I decided to check the controller and view files  
too.  
I set them all to utf8 and - it works now 🙂

Thanks

---

<div class="post-metadata">

**Author:** ![Joachim\_Reichel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@Joachim\_Reichel](https://www.ruby-forum.com/u/Joachim_Reichel)\
**Post date:** [June 9, 2007, 1:32pm UTC](https://www.ruby-forum.com/t/ror-problems-with-special-character-in-the-model/106362/5 "2007-06-09T13:32:48Z")

</div>

le 09/06/2007 00:55, Joachim Reichel nous a dit:

> The source file itself is encoded in utf-8.

You should triple check that - Because I had the same problem and the  
files was not utf-8 encoded (windows cp something instead)…
