[
https://issues.apache.org/jira/browse/NETBEANS-5308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17276649#comment-17276649
]
Chris McGee commented on NETBEANS-5308:
---------------------------------------
Before raising this issue I was looking at BEAM-8579, but it seems that it
hasn't fixed the problem with SQL files.
> Problems using SQL files with UTF-8 Byte Order Mark (BOM)
> ---------------------------------------------------------
>
> Key: NETBEANS-5308
> URL: https://issues.apache.org/jira/browse/NETBEANS-5308
> Project: NetBeans
> Issue Type: Bug
> Components: db - SQL Editor
> Affects Versions: 12.1
> Environment: *Product Version:* Apache NetBeans IDE 12.1
> *Java:* 15.0.1; OpenJDK 64-Bit Server VM 15.0.1+9
> *Runtime:* OpenJDK Runtime Environment 15.0.1+9
> *System:* Mac OS X version 10.15.7 running on x86_64; UTF-8; en_CA (nb)
> Reporter: Chris McGee
> Priority: Major
> Attachments: 386.sql
>
>
> While using NetBeans for doing database development work there are files that
> have UTF-8 BOM (Byte Order Mark) at the beginning that cause execution to
> fail mysteriously due to the invisible characters.
> {code}
> [1:1] Failed in 0 s.
> [Exception, Error code 0, SQLState 42601] ERROR: syntax error at or near "DO"
> Position: 1
> Line 1, column 1
> Execution finished after 0.004 s, 7 errors occurred.
> {code}
> Retyping the first line after backspacing it away doesn't remove the
> characters. Selecting the very first character to the end of the file doesn't
> help either. Checking View->Show non printable characters shows whitespace
> characters, but not the BOM. the Only visual clue what's happening is that
> the syntax highlighter isn't highlighting the first line correctly. Viewing
> the file with a hex editor is what revealed the BOM at the beginning causing
> all of the problems.
> The BOM is stripped away when opening the file in the editor or running it
> from the Projects panel (Right-click -> Run File). It is debatable whether
> the BOM should be stripped or preserved on save of the file.
> Steps to reproduce the problem:
> * Import the attached UTF-8 (+BOM) SQL file into a project that is set to
> UTF-8 encoding (Right-click -> Properties -> Sources -> Encoding)
> * Open the SQL editor
> * Pick a database connection (PostgreSQL in my case)
> * Click the Run SQL button at the top
> ** Query fails similarly above due to a problem at line1 column 1
> * Select all in the file, right-click -> Run Selection
> ** Query fails similarly
> * Try putting a new line at the beginning, select just the first SQL command
> to the end of the file and Run Selection
> ** Query fails similarly
> * Try running the SQL file from the Projects panels, right-click -> Run File
> ** Query fails similarly
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists