[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

RoR Problems with special Character in the model

Joachim Reichel

6/8/2007 10:55:00 PM

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 ?
4 Answers

Michael W. Ryder

6/8/2007 11:18:00 PM

0

Joachim Reichel wrote:
> 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 ?

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

Joachim Reichel

6/8/2007 11:36:00 PM

0

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.

>
> Have you tried using "Grundst\232cke" instead of "Grundstücke"?

user@domain.invalid

6/9/2007 11:26:00 AM

0

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)...

Joachim Reichel

6/9/2007 2:59:00 PM

0

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