Search Postgresql Archives

Re: pgsql cannot read utf8 files moved from windows correctly!

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

 



bookman bookman wrote:
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.


Not long ago i ran into a similar problem with UTF-8 and BOM. It turned out that a client of mine had edited some files in an old version of Homesite for Windows, which has a bit of an issue in this area:

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_19059&sliceId=1

Perhaps yours is a related problem?

brian

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[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