1

I have problem with enconding (i think) in Rails. When i put for example:

flash[:notice] = "ąęćół" 

in rails controller i see 500 error page. I set default encoding for MYSQL on

UTF-8 

but where i can set it for rails files?

Thanks for answers.

1 Answer 1

2

You need to put # -*- encoding: utf-8 -*- at the top of the file where you want to write text in Unicode

Sign up to request clarification or add additional context in comments.

3 Comments

is there some other way? I have many files when i need to do it. Hmm good solution will be a I18n file for translations then...
Yes you should put the texts in the yml files in config/locales. Please accept the answer anyway as this might come handy if you need to do specific testing for Unicode in your specs ;)
All you need is a comment containing coding: utf-8 in the first line of the file (or, after the shebang). The -*- are unnecessary

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.