Hi, Getting error messages when using the german letters ä,ö,ü,.., e.g. def show @title = "Über uns" <-- I had to modify to "Ueber uns" end
does anyone know how to overcome this issue ? thank you.
Dani
Hi, Getting error messages when using the german letters ä,ö,ü,.., e.g. def show @title = "Über uns" <-- I had to modify to "Ueber uns" end
does anyone know how to overcome this issue ? thank you.
Dani
What error messages are you getting and where ? which version of Ruby and Rails are you running ? def show is in a controller, I assume ?
Are you using ruby 1.9.2 with Mysql (via mysql gem)?
Here is what I'm getting: C:/Rails/hopp/app/controllers/pages_controller.rb:16: invalid multibyte char (US-ASCII) C:/Rails/hopp/app/controllers/pages_controller.rb:16: syntax error, unexpected tIDENTIFIER, expecting keyword_end @title = "�ber" ^ C:/Rails/hopp/app/controllers/pages_controller.rb:16: unterminated string meets end of file C:/Rails/hopp/app/controllers/pages_controller.rb:16: syntax error, unexpected $end, expecting keyword_end
I'm using Rails 3.0, Ruby 1.9.2, sqlite3.
Thanks.
Dani
any help here ? thank you. Dani
Add the magic comment:
# encoding: UTF-8
to the top of your source file
Klaus-dieter Gundermann wrote in post #956115:
Add the magic comment:
# encoding: UTF-8
to the top of your source file
Thank you.
What do you mean by "top of your source file" ?
The error says that the source is
The source of your template was: C:/Rails/app/views/pages/wir.html.erb, which has the following text:
# encoding: UTF-8 <h1>Wir</h1> <p> <%= image_tag("raum.jpg", :alt => "Studio Logo", :class => "round") %> <%= image_tag("willkommen.png", :alt => "Studio Logo", :class => "round") %> <% balance hei�t der neue Raum f�r ... %>
So I did put '# encoding: UTF-8' at the top of that file (as you can see above. Still same issue.
Any idea ?
Dani
Klaus-dieter Gundermann wrote in post #956115:
Add the magic comment:
encoding: UTF-8
to the top of your source file
Thank you.
What do you mean by “top of your source file” ?
The error says that the source is
The source of your template was:
C:/Rails/app/views/pages/wir.html.erb, which has the following text:
# encoding: UTF-8 <h1>Wir</h1> <p> <%= image_tag("raum.jpg", :alt => "Studio Logo", :class => "round") %> <%= image_tag("willkommen.png", :alt => "Studio Logo", :class => "round") %> <% balance hei�t der neue Raum f�r ... %>
So I did put ‘# encoding: UTF-8’ at the top of that file (as you can see
above. Still same issue.
Any idea ?
Dani
no the error is here
Radhames Brito wrote in post #956354:
in the controller
put the comment on the first line of the controller, it should be the pages controller
Thank you.
Yes, the text you mention is from the original part mentioned above, but in the meantime I have changed the text from "Über uns" to Ueber uns". So that now I have the problem in the above text mentioned text. Of course I can change the text form e.g. ü->ue, ä->ae,... (which I have done so I can go on developing. I did put the --> # encoding: UTF-8 in the controller, but same thing. Dani
Does your text editor support UTF-8? Are you saving the file as UTF-8? I guess the file encoding and comment specified in the "magic comment" must match.
jEdit is a text editor I know of with very good encoding support.
Will
William Denniss wrote in post #956507:
Does your text editor support UTF-8? Are you saving the file as UTF-8? I guess the file encoding and comment specified in the "magic comment" must match.
jEdit is a text editor I know of with very good encoding support.
Will
Thank you for your response. I don't understand exactly what you mean by 'editor support UTF-8?', I can type those characters ä,ü,..., and how is it related to the problem I have with the program ?. Would appreciate any help.
Dani
Thank you.
Yes, the text you mention is from the original part mentioned above, but
in the meantime I have changed the text from “Über uns” to Ueber uns".
So that now I have the problem in the above text mentioned text. Of
course I can change the text form e.g. ü->ue, ä->ae,… (which I have
done so I can go on developing.
I did put the → # encoding: UTF-8 in the controller, but same thing.
then the error message is misleading and the error is something else, try to check if there is something wrong with code above this line that may be making rails think that is the error
Dani Dani wrote in post #956895:
William Denniss wrote in post #956507:
Does your text editor support UTF-8? Are you saving the file as UTF-8? I guess the file encoding and comment specified in the "magic comment" must match.
jEdit is a text editor I know of with very good encoding support.
Will
Thank you for your response. I don't understand exactly what you mean by 'editor support UTF-8?', I can type those characters ä,ü,...,
Yes, but what encoding are you saving the file in? You should be saving the file with the UTF-8 encoding. Your editor should provide a feature to set the encoding. If it does not, get a different editor.
and how is it related to the problem I have with the program ?.
Simple: if the encoding is different from what Rails expects, then the characters will come out incorrectly.
An encoding is simply a mapping that says "when you see 0x0041, that represents 'A'." Files are just stored as byte sequences, so both the reader and writer have to know what the encoding is in order to make sense out of the file.
If this is hard to understand, you need to review some basic information about text encodings.
Would appreciate any help.
Dani
Best,
Hi, Great, thank you all especialy Will & Marnen, you are right, my editor was not set to utf-8 encoding. Now it is working !. Thanks for not giving up. Have a nice week, Dani