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

From: brian <brian(at)zijn-digital(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: pgsql cannot read utf8 files moved from windows correctly!
Date: 2007-12-23 16:45:08
Message-ID: 476E9094.4000409@zijn-digital.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Trevor Talbot 2007-12-23 18:55:26 Re: pgsql cannot read utf8 files moved from windows correctly!
Previous Message Louis-David Mitterrand 2007-12-23 16:38:45 Re: postgres UTC different from perl?