“...I've been working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it. Currently working for InPay...”

Rob Lacey
Senior Software Engineer, UK

Mysql2::Error: Incorrect string value

Waking up to an unexpected encoding error. Turns out the client has posted bullet points in their form data. It appears this isn’t working because the database is actually encoded in Latin1. Whereas it should be UTF-8.

An ActiveRecord::StatementInvalid occurred in jobs#create:

  Mysql2::Error: Incorrect string value: '\xE2\x80\xA8\x0D\x0A\x0D...' for column 'description' at row 1: INSERT INTO `stuffs`

Converted the character set to UTF-8 easily. However, through checking is probably prudent given that mixed encodings and converting them can have unexpected results

mysql> ALTER TABLE stuffs CONVERT TO CHARACTER SET utf8;
Query OK, 2350 rows affected (1.25 sec)
Records: 2350  Duplicates: 0  Warnings: 0
GPK of the Day Charred CHAD