|
3 | 3 | *
|
4 | 4 | * Copyright (c) 2000-2009, PostgreSQL Global Development Group
|
5 | 5 | *
|
6 |
| - * $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.96 2009/11/10 23:12:13 tgl Exp $ |
| 6 | + * $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.97 2009/11/21 23:59:12 petere Exp $ |
7 | 7 | */
|
8 | 8 | #include"postgres_fe.h"
|
9 | 9 | #include"mainloop.h"
|
|
14 | 14 | #include"input.h"
|
15 | 15 | #include"settings.h"
|
16 | 16 |
|
| 17 | +#include"mb/pg_wchar.h" |
| 18 | + |
17 | 19 |
|
18 | 20 | /*
|
19 | 21 | * Main processing loop for reading lines of input
|
@@ -167,6 +169,10 @@ MainLoop(FILE *source)
|
167 | 169 |
|
168 | 170 | pset.lineno++;
|
169 | 171 |
|
| 172 | +/* ignore UTF-8 Unicode byte-order mark */ |
| 173 | +if (pset.lineno==1&&pset.encoding==PG_UTF8&&strncmp(line,"\xef\xbb\xbf",3)==0) |
| 174 | +memmove(line,line+3,strlen(line+3)+1); |
| 175 | + |
170 | 176 | /* nothing left on line? then ignore */
|
171 | 177 | if (line[0]=='\0'&& !psql_scan_in_quote(scan_state))
|
172 | 178 | {
|
|