pgsql cannot read utf8 files moved from windows correctly!

From: "bookman bookman" <bookmanb(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: pgsql cannot read utf8 files moved from windows correctly!
Date: 2007-12-18 06:53:16
Message-ID: 28a0e9620712172253n697db1c0rd84eab124e43dfc1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

H i,

I copied a table in sqlserver2005 to a txt file(There were many
chinese words in it).I saved it as a file encoded by ANSI,but I cant
open it in ubuntu.I tried GBK,GB18030,
UTF8,It just could not be opened.

Then I save it in windows with encoding UTF8,then I can open it in
ubuntu.I copied it to postgresql,but the file could not be read
correctly.For example,here is a file:

--book.txt
bookid(int) bookname(varchar(30))
1 Java

I created a table "book" in postgre,then I input the command line:
copy book from '/home/postgres/data/book.txt'
The error was:
error:invalid input syntax for integer:" 1";
context:line 1,column bookid
I know that every line of utf8 files is started with "fffe" or "feff"
and ended with "\r\n" in windows but not in linux,so the character
"1" has a space before it in the error line.

Is there any way I can transfer utf8 file in windows to linux system?

Thank you!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2007-12-18 09:21:26 Re: slony error --need help
Previous Message Matt Magoffin 2007-12-18 06:30:22 Re: Many 8.3 server crashes in xmlCleanupCharEncodingHandlers()