I'm getting the following error:
ActiveRecord::StatementInvalid: PG::Error: ERROR: invalid byte sequence for encoding "UTF8": 0xf66e6bf6 : INSERT INTO "response_sets" ("city") VALUES ('Jönköping') RETURNING "id"
Database is PostgreSQL 9.0.6 on a Heroku app.
Not sure how to get around that error when there are odd characters.
Your database isn't set to the same encoding scheme as the string you're trying to insert. I would imagine Postgres on Heroku is set up to use UTF-8 by default and your input might be one of the latin variations if I had to guess. You can either set your database to accept the encoding scheme you're supplying, e.g.:
SET CLIENT_ENCODING 'ISO-8859-2'
Or you can transcode your input to UTF-8 (this is probably better)
"my string".encode('UTF-8')
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