http://www.perlmonks.org?node_id=669356

menolly has asked for the wisdom of the Perl Monks concerning the following question:

I'm attempting to export data from an old, non-strict database, scrub it, and import it into the stricter postgres 8.3. I've hit a snag with non-ASCII data scattered through the source. The bulk is ASCII, but an occasional field isn't -- not whole rows or whole columns, just a few fields. (The row I'm testing with has a name in Windows-1251 encoding, but there may be other encodings elsewhere.)

Like a good Monk, I searched, and found Is utf8, ascii ?, which seemed like the solution to my dilemma. Alas, my data is passing Perl's utf8::valid, but being rejected by Postgres with ERROR:  invalid byte sequence for encoding "UTF8": 0xcce5.

Obviously, I'm not an expert when it comes to handling non-ASCII data. Any further tips for detecting problem data?