Reputation: 185
I am using the copy command in Postgresql and I have a line of data in a text file that is tab seperated and I would like to copy it into the db table.
I get an error saying: ERROR: invalid byte sequence for encoding "UTF8": 0x00 SQL state: 22021 Context: COPY real_acct1, line 113038
So I went to the line 113038 from the text file and copied it along with 4 or 5 neighboring lines into a new text file and behold that new data went in.
Any helpful thoughts? This is parcel data attributes info.
Upvotes: 4
Views: 2609
Reputation: 601
Your problem is actually one of character encoding.
The easiest way to deal with this is running your import data through iconv (assuming you're on a unix machine).
iconv -f original_charset -t utf-8 originalfile > newfile
Upvotes: 2