Mysql - Mysql2::Error: Incorrect string value: -


so built scraper , pulling in objects. issue foreign languages , tripping mysql db bit. error got. idea can this? thanks!

mysql2::error: incorrect string value: '\xc5\x8dga, ...' column 'description' @ row 1: insert sammiches (country, created_at, description, image, name, updated_at) values ('japan', '2013-05-03 01:17:06', 'a hot dog bun stuffed fried noodles, topped pickles, such beni shōga, mayonnaise', '/wiki/file:yakisoba_sandwich_by_kaex0r.jpg', 'yakisoba-pan', '2013-05-03

this can triggered if string you're trying insert has invalid utf-8 byte sequences. example, in ruby can remove invalid characters using

string_with_invalid_sequences.encode('utf-8', 'binary', invalid: :replace, undef: :replace, replace: '') 

string#scrub can used in ruby 2.1 onwards

string_with_invalid_sequences.scrub 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -