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 44427 - EDITOR: UTF-16 encoded JSPs are saved as ISO-8859-1
Summary: EDITOR: UTF-16 encoded JSPs are saved as ISO-8859-1
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 4.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks: 44422
  Show dependency tree
 
Reported: 2004-06-07 14:00 UTC by Martin Schovanek
Modified: 2008-07-11 14:10 UTC (History)
2 users (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 2004-06-07 14:00:09 UTC
[Nb Build 200406061800, jdk1.5.0-b3]

JSPs with followin directive are saved as ISO-8859-2
<%@page contentType="text/html; charset=UTF-16"%>

Without the space after ";" it works fine. JSP 2.0
specification says that the space is optional.
Comment 1 Martin Schovanek 2004-06-07 14:02:01 UTC
TYPO: not ISO-8859-2 but ISO-8859-1
Comment 2 Martin Schovanek 2004-06-07 14:16:03 UTC
Pardon me, I wrong elvaluated my observations. The problem doesn't
depend on the space after ";" but the Editor plays even/odd.

odd saving => UTF-8
even saving => ISO-8859-2
Comment 3 Petr Pisl 2004-06-29 14:32:47 UTC
It looks like this problem is fixed with the putting the xerces on the
jsp parser classpath. 
Comment 4 Martin Schovanek 2007-02-01 12:05:36 UTC
Still reproducible:
1) create a .jsp with following page directive:
   <%@page contentType="text/html; charset=UTF-16"%>
2) type some Czech chars and save the document
NOTE: document is saved correctly
3) type more Czech chars and save it again
ERROR: Warning dialog: 'The document contains characters which will be damaged
during the conversion into ISO-8859-1 char set.' appears
4) cancel the dialog and save it again
NOTE:  document is saved correctly
Comment 5 Jiri Prox 2007-09-17 21:41:39 UTC
Obsolete milestone, please reevaluate
Comment 6 Petr Hejl 2007-10-11 14:22:58 UTC
Issue is still reproducible.
When the file is closed after the encoding was changed and than reopened again everything works correct. Reproducibility
seems to be dependent on some internal state.
Comment 7 Petr Hejl 2007-10-11 15:07:57 UTC
Seems to be a threading issue for file encoding.
Comment 8 Petr Hejl 2007-10-11 20:45:56 UTC
The root cause is the file stored in plain UTF-16 (for specific conditions) - without byte order mark. After that jasper
is not able to determine the charset and returns ISO-8859-1.

Another, almost same issue: issue 44416.
Comment 9 Petr Hejl 2007-10-12 14:15:55 UTC
The real cause of the problem follows: File is stored with charset UTF-16 and encoder adds BOM (saving it as UTF-16BE).
It's correct. When the content in the editor is changed and saved again ide uses the UTF-16BE encoder for the _editor
content_ and this encoder does not save any BOM (and no BOM _in editor_ exists). The result is the incorrect file on the
disk (UTF-16 without BOM).
Comment 10 Petr Pisl 2007-10-16 13:44:38 UTC
The root of the problem is now known. 
Comment 11 jiai 2008-01-11 11:16:43 UTC
Same problem exists now with UTF-8 in VW 4.1.1 (at least in the woodstock nbm component)! When you open a VW-JSF in an
UTF-8 project, the XML encoding is set to ISO-8859-1, the contentType to charset=UTF-8 and pageEncoding=ISO-8859-1.
When you correct it, it will be switched when the project is started with "Run".

Result: backing beans strings with umlauts on JSF pages and submitted textfields with umlauts are mangled in Firefox!
This is absoluteley unacceptable - therefore I raise the priority to P1; it makes Netbeans unusuable for creating web
content for languages like German. You need to fix this!

Product Version: NetBeans IDE 6.0 (Build 200711261600)
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06
System: Windows XP version 5.1 running on x86; Cp1252; de_DE (nb)
Comment 12 jiai 2008-01-11 11:39:21 UTC
There was an error in my statement - backing beans strings with umlauts are not affected as such. The problem arises
when you submit field contents with german umlauts - they get mangled when you redisply them.
Comment 13 Marek Fukala 2008-01-14 22:12:43 UTC
> When you open a VW-JSF in an UTF-8 project, the XML encoding is set to ISO-8859-1, the contentType to charset=UTF-8
and > pageEncoding=ISO-8859-1.
I am sorry, I am not aware of all the aspects of the VW so I may miss something, but are you talking about creating of a
of the file, aren't you? Can you attach the file please?

> When you correct it, it will be switched when the project is started with "Run".
Can you also attach the file after the correction?

The problem you described here is imho unrelated to what was reported before, but I'll wait with the resolution for your
replay. Thanks in advance.
Comment 14 Marek Fukala 2008-01-22 08:16:16 UTC
Please answer the questions, I am downgrading the issue to P2 since the justification for P1 is not clear.
Comment 15 Marek Fukala 2008-02-20 14:47:43 UTC
The issue explored by Petr H. needs to be fixed.
Comment 16 Marek Fukala 2008-02-26 11:36:12 UTC
Petre, since you did the deep investigation and found the problem, can you also fix it please? Thanks.
Comment 17 Petr Hejl 2008-03-03 12:53:20 UTC
Fixed in changeset 81ae90caf0df.
Comment 18 josin 2008-07-11 14:07:02 UTC
Product Version: NetBeans IDE Dev (Build 200807101204)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Linux version 2.6.24-19-generic running on i386; UTF-8; en_US (nb)
Userdir: /home/josin/.netbeans/dev
Comment 19 josin 2008-07-11 14:10:25 UTC
Issue ok and verified.

Product Version: NetBeans IDE Dev (Build 200807101204)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Linux version 2.6.24-19-generic running on i386; UTF-8; en_US (nb)
Userdir: /home/josin/.netbeans/dev