Bug 109255 - [encoding] FileDocumentProvider does not detect bom as expected
Summary: [encoding] FileDocumentProvider does not detect bom as expected
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P2 major (vote)
Target Milestone: 3.1.1   Edit
Assignee: Dani Megert CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-11 13:04 EDT by Martin Schnabel CLA Friend
Modified: 2005-09-26 06:42 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Schnabel CLA Friend 2005-09-11 13:04:19 EDT
setDocumentContent has a bom check for excluding the bom from the editable document.
the checks look like this:
FileInfo info= (FileInfo) getElementInfo(element);
if (info != null && info.fHasBOM && CHARSET_UTF_8.equals(encoding)) {
..
}
but the cached flag fHasBOM of the FileInfo is created after setDocumentContent
is called.
in createElementInfo is called in connect
setDocumentContent is called before cacheEncodingState in createElementInfo.

same problem with doSaveDocument
but i have not debugged it.

i have fixed that problem for the ASDT plugin with a uncached check.
Comment 1 Dani Megert CLA Friend 2005-09-19 07:03:14 EDT
Works when using file buffer based document provider (e.g.
TextFileDocumentProvider).
Comment 2 Dani Megert CLA Friend 2005-09-19 07:08:34 EDT
This needs to be fixed for 3.1.1.
Comment 3 Dani Megert CLA Friend 2005-09-19 13:01:16 EDT
Fixed in HEAD and R3_1_maintenance.
Will be released into 3.2 M2 and 3.1.1.
Comment 4 Tom Hofmann CLA Friend 2005-09-26 06:29:03 EDT
verifying...
Comment 5 Tom Hofmann CLA Friend 2005-09-26 06:42:45 EDT
verified that a UTF-8 with BOM file opened with an editor using
FileDocumentProvider works correctly:
- encoding is UTF-8 with BOM
- no additional characters displayed