E
E
Evgeny Elchev2014-10-22 21:09:17
Ruby on Rails
Evgeny Elchev, 2014-10-22 21:09:17

Rails 4 Russian characters in base cause error?

Actually, as soon as I try to display a string with Russian characters from the database, I get an error incompatible character encodings: UTF-8 and ASCII-
8BIT Then I tried to put the 'russian', 'mysql2', 'ruby-mysql' gems, added magic comments, tried to add lines to the configs, but all in vain, the error did not disappear anywhere. This bug is more than two years old, has anyone found a simple solution?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
eugzol, 2014-10-22
@rsi

Hmm, this error disappeared when I switched to the mysql2 gem from mysql.

V
Viktor Vsk, 2014-10-22
@viktorvsk

Correct me if wrong. Do you think that for at least 2 years no one has been developing on Rails, keeping the Cyrillic alphabet in the database?

E
exvion, 2014-10-23
@exvion

What editor are you using? Check the encoding of the *.html.erb files into which you output the string. Show the full bug report.

R
romanwb, 2014-10-23
@romanwb

I began to dig further towards the "mysql2" gem, and after I completely recreated the database using this gem, everything finally worked.

It's good that the problem is solved.
I will add, perhaps you registered the configs (encoding + comparison), but the database itself was not converted.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question