php postgresql convert mixed encoding to utf-8
Posted on 2014-12-08
I have user input/EDI that may be in different encoding (ISO, Win, etc.). When I insert it into the database PostgreSQL complain "invalid byte sequence for encoding "UTF8".
PostgreSQL DB encoding is UTF-8.
I cannot control the user input/EDI. The SQL query actually has mixed encoding, including UTF-8.
Is there a way to convert the none UTF-8 strings/chars to UTF-8 and ignore the strings/chars that are already UTF-8?