mukesh
mukesh

Reputation: 127

Rails/Devise/ActiveRecord not accepting unicode characters

I am using Devise with rails 4 and ruby 2.0 and database is MySQL Ver 14.14 Distrib 5.5.38. When a user sign up with names like "Мукеш"(Russian for Mukesh), I get an error as below

Mysql2::Error: Incorrect string value

I tried editing the database through MySQL Workbench and it is working, but rails is showing question marks when displaying that data.

How can I tell the ORM/Rails/Devise to accept Unicode characters? Please let me know if more details are needed

Thanks in advance,

Upvotes: 0

Views: 426

Answers (1)

mukesh
mukesh

Reputation: 127

This is an issue with MySQL database column. Enlightened by @minthouse's words, I changed the encoding of the name column, instead of the entire table.

ALTER TABLE users MODIFY name VARCHAR(50) CHARACTER SET utf8;

Thanks @minthouse for your help

Upvotes: 0

Related Questions