This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 149277 - UTF-16 encoding detected by parser as UTF-16BE
Summary: UTF-16 encoding detected by parser as UTF-16BE
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Marek Fukala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-06 18:26 UTC by Martin Schovanek
Modified: 2009-11-02 11:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Schovanek 2008-10-06 18:26:06 UTC
[#200810060201, jdk1.5.0]

to reproduce:
-------------
1) create a new .jsp
2) set the encoding to UTF-16 and save it
3) set the encoding to UTF-8 and save it
ERROR1: the page is saved in UTF-16 and you got message: 'Page-encoding specified in XML prolog (UTF-16BE) is different
from that specified in page directive (UTF-8)'
4) remove the 'pageEncoding="UTF-16"' from <%page directive, save and close document
5) reopen it, put the 'pageEncoding="UTF-16"' atribute back and save the document
ERROR2: the document starts with two BOM marks
Comment 1 Marek Fukala 2008-10-09 15:35:37 UTC
This is caused by jsp parser returning UTF-16BE encoding for a file with UTF-16 encoding. The UTF-16 encoding has
mandatory BOM, for UTF-16BE it is arbitrary. In fact both encoding are the same. Since the UTF-16BE character decoder
doesn't expect BOM the BOM is written into the document content. When saving the file the BOM is added so it is
duplicating. 

Can be fixed by not loading the BOM chars in the BaseJspEditorSupport.loadFromStreamToKit() for UTF-16BE encoding if
they are present.
Comment 2 Marek Fukala 2008-11-19 11:41:32 UTC
future=>later
Comment 3 Quality Engineering 2009-11-02 11:17:49 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX