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 109193 - I18N - IllegalCharsetNameException when closing and saving html file with unknown charset setting
Summary: I18N - IllegalCharsetNameException when closing and saving html file with unk...
Status: VERIFIED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Marek Fukala
URL:
Keywords: I18N
Depends on:
Blocks: 120529
  Show dependency tree
 
Reported: 2007-07-10 02:35 UTC by rburkhead
Modified: 2009-05-18 10:47 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stack trace from details of exception dialog (4.51 KB, text/plain)
2007-07-10 02:36 UTC, rburkhead
Details
Log file from Netbeans session, including only recreation steps detailed in issue (84.98 KB, text/plain)
2007-07-10 02:38 UTC, rburkhead
Details
Steps to recreate File->Save behavior (971 bytes, text/plain)
2007-07-10 02:56 UTC, rburkhead
Details
Copy of log file from session recreating File->Save issue (57.99 KB, text/plain)
2007-07-10 02:57 UTC, rburkhead
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rburkhead 2007-07-10 02:35:30 UTC
An IllegalCharsetNameException is thrown when closing and then electing to save an html file with an unknown charset.

*** To recreate:

- Create a new html file

- Set the contents of the file to:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=<!--[charset]-->">
</head>
<body>
</body>
</html>

- Close the file by clicking on the "X" located on the file's tab in the editor pane.

- When asked to Save, Discard or Cancel, choose "save"

*** Resulting behavior:

- NetBeans notifies the user that an IllegalCharsetNameException has occurred.

- Additionally, a dialog box is popped up below the exception notification stating:

"File {filename} was modified externally. Reload it?"  Where "{filename}" is the path and name of the file in question.

*** Expected behavior:

- File is saved with a system default charset, or alternatively the user is prompted for a charset encoding for the file
without changing the tag in the html file.

*** Justification for allowing "unknown" charset values:

Often html files are used as templates in content management systems (CMSs) based on dynamic languages such as PHP. 
These template files are passed through various processes on the way out to the user, to combine content and dynamic
data.  Some CMSs allow the charset of the generated output to be selected through configuration, and the generation
process(es) convert the template content and dynamic data to the proper charset prior to delivering the final content to
the user.  In order to specify the proper charset in the markup, a variable placeholder must be used (e.g.,
<!--[charset]-->) to specify where the CMS should ultimately indicate the final charset value used.

*** Attachments:

- Stack trace from details of exception notification dialog
- messaged.log file from session

*** See also:

Issues 18651, 41053, and possibly others.
Comment 1 rburkhead 2007-07-10 02:36:44 UTC
Created attachment 44860 [details]
Stack trace from details of exception dialog
Comment 2 rburkhead 2007-07-10 02:38:02 UTC
Created attachment 44861 [details]
Log file from Netbeans session, including only recreation steps detailed in issue
Comment 3 rburkhead 2007-07-10 02:50:57 UTC
A related issue arises when the user attempts to save the file with the File|Save command.  The status bar indicates
that the file was saved, however it was not actually saved.  No exception seems to be raised.  See additional recreation
script and log file.  If you would like me to file this as a separate issue, please let me know.
Comment 4 rburkhead 2007-07-10 02:56:32 UTC
Created attachment 44863 [details]
Steps to recreate File->Save behavior
Comment 5 rburkhead 2007-07-10 02:57:21 UTC
Created attachment 44864 [details]
Copy of log file from session recreating File->Save issue
Comment 6 Marek Fukala 2007-07-10 15:56:33 UTC
Thanks for such detailed report, I'll try to address the problem soon.
Comment 7 Ken Frank 2007-10-03 19:24:07 UTC
can this be addressed for nb6 ?  since nb6 has other changes about file and project encoding
it can help with consitency.

also see 106473 - I wonder if some things mentioned there apply to
this issue ?

ken.frank@sun.com
Comment 8 Andrei Badea 2007-10-31 15:19:57 UTC
Seems to me this has been fixed already in issue 111496. When I save a HTML file with an invalid charset I get a dialog
informing me about it and offering to save the file in the project encoding.
Comment 9 Ken Frank 2007-10-31 17:38:48 UTC
Could submitter see if its ok now using latest netbeans build ?

ken.frank@sun.com
Comment 10 rburkhead 2007-11-11 19:31:35 UTC
Verified on NB 6 Daily Build 2007-11-11_01-16-45