Summary:
psql "include" or "\i" command chokes on UTF8 text files prefixed with BOM.
Steps to reproduce:
- create a UTF8 file with three byte BOM 'EF BB BF'.
- include the file from psql via the "include" or \i command.
Example output for file named "test.sql" below:
redacted-# \i test.sql
psql:test.sql:1: ERROR: syntax error at or near ""
LINE 1: 
Background
https://en.wikipedia.org/wiki/Byte_order_mark
Some text editors save text to a file prefixed by a BOM or byte marker. This includes Visual Studio, VSCode and others. I think it would be reasonable for the include command to skip over any BOM found in the first two or three bytes of a file.