Incomplete multibyte character when using postgres

Has anybody ran into this error with rails and postgres? I get this quite a bit and I have no idea why.

Has anybody ran into this error with rails and postgres? I get this quite a bit and I have no idea why.

Usually a botched UTF8 issue. Make sure that the database, rails, the website, everything agrees on the character set.

Whenever this happens to me, it's usually from parsing Excel files that have been converted to CSV that I'm trying to import and they are simply botched up... and I either end up hand fixing them or running them through Iconv to squash the bad characters, but that means losing some things occasionally.

I resolved this doing: self.myfield.squish in my case i was inserting, then before save i did: self.myfield = self.myfield.squish