N
N
Nitrino2013-02-11 13:40:25
Ruby on Rails
Nitrino, 2013-02-11 13:40:25

Sql like Russian words case insensitive in rails?

There was a problem, when querying the database, Russian (Cyrillic) words are compared case-sensitive, although at the same time Latin is compared case-insensitively.
Tried to defeat this with .mb_chars.downcase.to_sand lowerin the query, but to no avail.

where('lower(first_name) like ?', name).mb_chars.downcase.to_s<br>

Suggest a solution to this problem

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nitrino, 2013-02-11
@Nitrino

I figured out that this is a feature of sqlite, by default the lower function in it does not work for UTF-8, you need to either write your own function or take an sqlite assembly with unicode support. On production with mysql everything works.

V
Vyacheslav Plisko, 2013-02-11
@AmdY

What is the encoding in your database, not bin by any chance?

S
sl_bug, 2013-02-11
@sl_bug

version of ruby, rails and the resulting sql query from the logs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question