Re: Support UTF-8 files with BOM in COPY FROM
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Brar Piening <brar@gmx.de>
Cc: Robert Haas <robertmhaas@gmail.com>, Tatsuo Ishii <ishii@postgresql.org>, david@kineticode.com, itagaki.takahiro@gmail.com, pgsql-hackers@postgresql.org
Date: 2011-09-26T19:48:53Z
Lists: pgsql-hackers
Brar Piening <brar@gmx.de> writes: > Citing from the Unicode FAQ again: > Q: Where is a BOM useful? > A: A BOM is useful at the beginning of files that are typed as text, but > for which it is not known whether they are in big or little endian > formatit can also serve as a hint indicating that the file is in > Unicode, as opposed to in a legacy encoding and furthermore, it act as a > signature for the specific encoding form used. Note that the reference to byte order betrays the implicit context assumption: that we're talking about UTF16 or UTF32 representation. A BOM in UTF8 data is useless for its intended purpose of disambiguating byte order. It could possibly be useful for telling UTF8 data apart from non-UTF8 data, except for the inconvenient fact that that byte sequence is not invalid data in non-UTF8 encodings. BOM is useless in UTF8, no matter what Microsoft thinks. Any tool that relies on it to detect UTF8 data has to have a workaround for overriding that detection, or it's broken to the point of uselessness. regards, tom lane