So I built a scraper and am pulling in some objects. The issue is some are foreign languages and it is tripping the mysql db up a bit. This is the error I got. Any idea what I can do with this? Thanks!
Mysql2::Error: Incorrect string value: '\xC5\x8Dga, ...' for column 'description' at row 1: INSERT INTO
sammiches
(country
,created_at
,description
,image
,name
,updated_at
) VALUES ('Japan', '2013-05-03 01:17:06', 'A hot dog bun stuffed with fried noodles, frequently topped with pickles, such as beni shōga, with mayonnaise', '/wiki/File:Yakisoba_sandwich_by_kaex0r.jpg', 'Yakisoba-pan', '2013-05-03
This can also be triggered if the string you're trying to insert has invalid UTF-8 byte sequences. For example, in ruby you can remove any invalid characters using
string_with_invalid_sequences.encode('utf-8', 'binary', invalid: :replace, undef: :replace, replace: '')
String#scrub can be used in ruby 2.1 onwards
string_with_invalid_sequences.scrub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With