Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 156585 - Display / encoding problems with files of type text/x-sql
Display / encoding problems with files of type text/x-sql
Product: db
Classification: Unclassified
Component: SQL Editor
Other Linux
: P3 (vote)
: 6.x
Assigned To: Jiri Skrivanek
Depends on:
  Show dependency treegraph
Reported: 2009-01-12 03:32 UTC by malm
Modified: 2009-09-18 22:47 UTC (History)
0 users

See Also:
Issue Type: DEFECT

Screenshot of garbled display (24.03 KB, image/png)
2009-01-12 03:33 UTC, malm
Request SQL file in UTF-16 encoding as created by SQL Server Mgmt Studio (1.23 KB, text/plain)
2009-09-14 15:09 UTC, malm

Note You need to log in before you can comment on or make changes to this bug.
Description malm 2009-01-12 03:32:25 UTC
I have SQL scripts created with MS SQL Server Management Studio which display illegible when viewed with NetBeans (will
attach screenshot). It looks like an encoding issue. The same file when given a .SQL extension instead of .sql (I am
using Linux so file extensions are case sensitive) displays fine in NetBeans. So my suspicion is that the component
dealing with text/x-sql files is determining the file encoding incorrectly.
Comment 1 malm 2009-01-12 03:33:23 UTC
Created attachment 75677 [details]
Screenshot of garbled display
Comment 2 malm 2009-01-12 04:04:21 UTC
May be I was a bit quick with this issue as it is not related to the file extension. Further investigation showed that
the problem is related to MS SQL Server Management Studio using UTF-16 encoding by default (can't seem to change the
default) when saving files and NetBeans appears not to be able to understand that encoding. Looking at the file in a
binary editor it appears to correctly start with the Unicode BOM so the format should be detectable.
Comment 3 Jaromir Uhrik 2009-01-12 13:57:47 UTC
Passing to editor - please evaluate. Thanks.
Comment 4 Vitezslav Stejskal 2009-01-15 11:59:12 UTC
In general file encoding in Netbeans is set for a project and you can change it in Properties -> Sources -> Encoding.
The encoding will apply for all files in the project. However, some files can specify their own encoding independently
on the project (eg. AFAIK JSP, xml files do so). I think this is controlled by FileEncodingQuery implementations
provided by editor support modules for those languages. Therefore I'm passing this on to sql editor folks.

As a quick solution I would suggest to change the encoding of the project where you have your SQL files to UTF-16.
Comment 5 Jiri Rechtacek 2009-02-10 15:16:07 UTC
Reassigned to new owner.
Comment 6 Jiri Skrivanek 2009-09-14 14:59:35 UTC
Could you attach sample UTF-16 file?
Comment 7 malm 2009-09-14 15:09:10 UTC
Created attachment 87615 [details]
Request SQL file in UTF-16 encoding as created by SQL Server Mgmt Studio
Comment 8 Jiri Skrivanek 2009-09-15 10:24:45 UTC
Added SQLFileEncodingQueryImpl which detects UTF-16 encoding.
core-main #f26a5195d9d0
Comment 9 Quality Engineering 2009-09-18 22:47:02 UTC
Integrated into 'main-golden', will be available in build *200909181401* on (upload may still be in progress)
User: Jiri Skrivanek <>
Log: #156585 - Detect UTF-16 encoding for SQL files.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo