PostgreSQL copy prompt: Error:invalid byte sequence for encoding "UTF8": 0xb3

Source: Internet
Author: User
Tags postgresql psql

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.