Thanks for the insight, but I think the issue is at the rails level. Since 
when I tried inserting the same values in the mysql db directly, it worked 
without any errors. It might be because the character that I am trying to 
insert is not UTF8. But rails is enforcing that encoding. What would be the 
encoding change required to be done at rails level?

Also, I have a system where I would need to scale things later. So, I would 
have to change the encoding of a particular table every time I have to 
create a new instance. Is there any way to deal with that?

On Monday, January 5, 2015 11:43:31 PM UTC+5:30, Hassan Schroeder wrote:
>
> On Mon, Jan 5, 2015 at 10:00 AM, Kriti Aggarwal <krit...@gmail.com 
> <javascript:>> wrote: 
> > Following are the encodings/collations and versions that I am using: 
> > Rails : utf8, 4.0 
> > Mysql: latin_general_ci, 14.14 Distrib 5.5.40 
>
> Well, it should be pretty obvious you have a mismatch there, which is 
> a problem. But there's not just one encoding-related variable. Example: 
>
> mysql> show variables like '%char%'; 
> +--------------------------+--------------------------------------------------------+
>  
>
> | Variable_name            | Value 
>              | 
> +--------------------------+--------------------------------------------------------+
>  
>
> | character_set_client     | utf8 
>              | 
> | character_set_connection | utf8 
>              | 
> | character_set_database   | utf8 
>              | 
> | character_set_filesystem | binary 
>              | 
> | character_set_results    | utf8 
>              | 
> | character_set_server     | utf8 
>              | 
> | character_set_system     | utf8 
>              | 
> | character_sets_dir       | 
> /usr/local/mysql-5.6.13-osx10.7-x86_64/share/charsets/ | 
> +--------------------------+--------------------------------------------------------+
>  
>
> 8 rows in set (0.00 sec) 
>
> mysql> show variables like '%coll%'; 
> +----------------------+-----------------+ 
> | Variable_name        | Value           | 
> +----------------------+-----------------+ 
> | collation_connection | utf8_general_ci | 
> | collation_database   | utf8_general_ci | 
> | collation_server     | utf8_general_ci | 
> +----------------------+-----------------+ 
> 3 rows in set (0.01 sec) 
>
> You want, at the least, all of those consistent. If you need the 4-byte 
> character capability, then set them appropriately. 
>
> Note: you'll need to manually alter (or drop and recreate) existing 
> databases/tables afterwards. 
>
> HTH, 
> -- 
> Hassan Schroeder ------------------------ hassan.s...@gmail.com 
> <javascript:> 
> http://about.me/hassanschroeder 
> twitter: @hassan 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1646bb47-2dc1-4306-8112-c663e008b0e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to