Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit93d3bac

Browse files
committed
Ignore UTF-8-encoded Unicode byte-order mark at the beginning of a file if
the client encoding is UTF-8.a limited version of a patch proposed by Itagaki Takahiro
1 parente6c63bf commit93d3bac

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/bin/psql/mainloop.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
55
*
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 $
77
*/
88
#include"postgres_fe.h"
99
#include"mainloop.h"
@@ -14,6 +14,8 @@
1414
#include"input.h"
1515
#include"settings.h"
1616

17+
#include"mb/pg_wchar.h"
18+
1719

1820
/*
1921
* Main processing loop for reading lines of input
@@ -167,6 +169,10 @@ MainLoop(FILE *source)
167169

168170
pset.lineno++;
169171

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+
170176
/* nothing left on line? then ignore */
171177
if (line[0]=='\0'&& !psql_scan_in_quote(scan_state))
172178
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp