Three file formats are used for testing:
ISO-8859
NETPBM PBM Image
Ascii
if[$ (File $filename |grep-c "ISO-8859")-GT 0]
Then
Echo "ISO-8859"Psql-C"copy $schemaname. $tbname from ' $dirname/$filename ' with (format ' csv ', delimiter ', Encoding ' iso-8859-1 ')"$dbnameelif[$ (File $filename |grep-c "ASCII")-GT 0]
Then
Echo$format Psql-C"copy $schemaname. $tbname from ' $dirname/$filename ' with (format ' csv ', delimiter ', Encoding ' UTF-8 ')"$dbnameElsePsql-C"copy $schemaname. $tbname from ' $dirname/$filename ' with (format ' csv ', delimiter ', Encoding ' iso-8859-1 ')"$dbname
This processing occurs when the file format is ASCII, and the encoding error message will still appear halfway through copy.
Error:invalid byte sequence for encoding "UTF8": 0xb3
Finally groping to find that no matter what format, are designated as iso-8859-1 can be processed.
Fully inclusive encoding format that can handle:
Psql-c "Copy $schemaname. $tbname from ' $dirname/$filename ' with (format ' csv ', delimiter ', Encoding ' iso-8859-1 ')" $dbnam E
PostgreSQL copy prompt: Error:invalid byte sequence for encoding "UTF8": 0xb3