Search Postgresql Archives

pgsql cannot read utf8 files moved from windows correctly!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux