Thread: Weird characters saved in SQL file
Hi, I'm running pgadmin 1.8.0 Beta 5 (rev: 6630:6631) on Mac OS X 10.4.10 against postgresql 8.2.3... I've written a bunch of table create statements using the SQL editor tool and saved them as files... Then I used a php script to parse the files and run them against the database in a specific order. For some reason, at the beginning of each file are some hidden characters... 0xEF. 0xBB & 0xBF respectively. This seems odd to me. Of course, it caused errors when sending the contents of the files to the database. I'm now removing those characters before sending the sql to the database and it works fine now... but a bit of a pain in the ass. IMHO, they shouldn't be there in the first place. You can't see them when opening the file using pgadmin, but if you open the file using vim or something, you will see them there. Thanks, Scott -- Scott Sturgeon <scotts@nettwerk.com> Senior Software Developer Nettwerk Music Group http://www.nettwerk.com
Am 22.09.2007 um 00:01 schrieb Scott Sturgeon: > Hi, > > I'm running pgadmin 1.8.0 Beta 5 (rev: 6630:6631) on Mac OS X > 10.4.10 against postgresql 8.2.3... > > I've written a bunch of table create statements using the SQL > editor tool and saved them as files... Then I used a php script to > parse the files and run them against the database in a specific > order. For some reason, at the beginning of each file are some > hidden characters... 0xEF. 0xBB & 0xBF respectively. This seems odd > to me. Of course, it caused errors when sending the contents of the > files to the database. I'm now removing those characters before > sending the sql to the database and it works fine now... but a bit > of a pain in the ass. IMHO, they shouldn't be there in the first > place. You can't see them when opening the file using pgadmin, but > if you open the file using vim or something, you will see them there. <EF><BB><BF> to be precise. Certainly confuses the shell, less does not recognise the file as a text file. I don't know whether this a cookie which associates the file with pgAdmin but I don't really think it's a bug. Charlie -- Charlie Clark Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226
On Sep 22, 2007, at 10:15 AM, Charlie Clark wrote: > <EF><BB><BF> to be precise. Certainly confuses the shell, less does > not recognise the file as a text file. I don't know whether this a > cookie which associates the file with pgAdmin but I don't really > think it's a bug. I think what you are seeing is a unicode byte order mark (BOM): http://en.wikipedia.org/wiki/Byte_Order_Mark I don't know what encoding pgAdmin is using, but if it is UTF-8 then there is probably no reason to have it. Or at least there needs to be preference to leave it out. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL
> ------- Original Message ------- > From: John DeSoi <desoi@pgedit.com> > To: Charlie Clark <charlie@begeistert.org> > Sent: 22/09/07, 20:30:45 > Subject: Re: [pgadmin-support] Weird characters saved in SQL file > > On Sep 22, 2007, at 10:15 AM, Charlie Clark wrote: > > > <EF><BB><BF> to be precise. Certainly confuses the shell, less does > > not recognise the file as a text file. I don't know whether this a > > cookie which associates the file with pgAdmin but I don't really > > think it's a bug. > > > I think what you are seeing is a unicode byte order mark (BOM): Sounds like it - it does write them. Under File->Options you can turn off UTF-8 mode. Try that to confirm what's happening. Regards, Dave