I had the same problem in my rails project:
Incorrect string value: '\xF0\xA9\xB8\xBDs ...' for column 'subject' at row1
Solution 1: before saving to db convert string to base64 by Base64.encode64(subject)
and after fetching from db use Base64.decode64(subject)
Solution 2:
Step 1: Change the character set (and collation) for subject column by
ALTER TABLE t1 MODIFY
subject VARCHAR(255)
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
Step 2: In database.yml use
encoding :utf8mb4