Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Case insensitive search for unicode


  • Please log in to reply
No replies to this topic

#1 barbq

barbq

    Passenger

  • Members
  • 1 posts

Posted 10 November 2013 - 03:57 PM

Hi everyone,

 

I have this query: 

Location.where("lower(name) = ?",name.downcase)

Which works well, but when I tried it with Russian characters it seems to fail.

Location.where("lower(name) = ?","Серебрянный дождь".downcase)

This returns 0 results, where:

Location.where("name = ?","Серебрянный дождь".downcase)

returns 1 result (dropped the "lower(...)")

 

I'm not entirely sure what's going on (notice in ruby: "Серебрянный дождь".downcase = "Серебрянный дождь").

I could theoretically do "lower(...)" only from string that contain only A-Z characters, but that's too cumbersome than I'd like as I need this code to work in a lot of places..

 

Thanks..!

 

 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users