Skip to content

utf8mb4  #367

Closed
Closed
@kadkins

Description

@kadkins

I am using MariaDB 5.5 but had the same issue with MySQL 5.5

  • I can add/edit/view 4-byte utf-8 characters (iOS emoji's for example) from a terminal and sql gui client
  • my.cnf is set to use utf8mb4 as default charset
    • I set the databases default encoding to utf8mb4

Using Rails 3.2.13 database.yml

staging:
  adapter: mysql2
  host: dbstage01
  database: sp_stage
  username: sp_stage
  password: 12345678
  encoding: utf8mb4
  collation: utf8mb4_unicode_ci
  port: 3306

I have tried with and without collation:, encoding: hoping it would use the databases default encoding as well as using just using utf8.

Using native Rails 3 gem 'gem mysql2':

  • rake db:create fails with 'Unsupported charset: '"utf8mb4"' message

Using gem 'mysql2', :git => "https://github.com/brianmario/mysql2.git"

  • The database and migrations complete, but it is not using utf8mb4 as specified in the config file.
  • 4 byte emoji displays as ?'s

I was able to fix this on an earlier project using mysql5.5 and writing a bunch of scripts to go through each table and column, changing charsets and collations to utf8mb4, and also setting indexes on utf8mb4 to a max of 191 characters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions