According to "Incorrect string value" when trying to insert UTF-8 into MySQL via JDBC? , if I want to store data that contains 4-byted UTF-8 characters, mysql's column need to have a utf8mb4
encoding.
I'm using Zlib::Deflate.deflate
to compress a string and would like to store it in Mysql.
Upon inserting the record, I get the following:
ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect string value: '\x96Iv$!\x0C...'
So basically, I will either have to change the column's encoding or force Zlib::Deflat.deflate
to generate only 3-byted UTF-8 characters. Is there a way to do this?