Skip to content


database driver Character Set hassles are not just a pain in Oracle

To use utf8 in mysql from a client you must execute: set names "utf8" query.
There are a number of character_set properties that can be set, issuing the set names query will ensure the 3 appropriate character_set_* properties are changed to your character set.

Then you can insert values without getting them converted to latin on the client.

Too bad ActiveRecord::Base doesn't already have a hook for these on start queries, since you need to issue some query to set character set properties for just about every database anyway.

Post to Twitter Tweet This Post

Posted in General. Tagged with , .

3 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Anonymous said

    I think
    encoding: utf8
    in database.yml is supported..

  2. Hi, I’d appreciated that if you could tell me how to define encoding UTF-8 in a json file.
    Whenever I copy or type a Chinese name if widget.json, it became a funny letter at run time.
    My question is how do I specify encoding in a json file, sort of in a jsp?
    I thank you in advance!

    Joe

  3. brett said

    <p>I assume you are correctly sending back json in utf-8 format so the problem is probably around the browser encoding.</p>
    <p>Lots of people have already investigated this issue, google or check out http://jerakeen.org/test/unicode/&lt;/p&gt;

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.


Twitter links powered by Tweet This v1.6.1, a WordPress plugin for Twitter.