Sunday, August 26, 2012

Broken/non-ASCII characters in PostgreSQL

We were trying to get PostgreSQL data to SQL server and got following error:

ERROR: character 0xc294 of encoding "UTF8" has no equivalent in "WIN1252"

From error we could get that there are some characters which are not compatible. We googled a lot to find solution but couldn’t find it. So then we had to build a query which fill find such incompatible data.  

Following query will find all the fields having one or more non-ASCII characters like: à

SELECT * FROM <table name> WHERE <column name> similar to '%[^\x20-\x7e]+%'

Hope you find it useful.


No comments:

Post a Comment