Summary: | [Encoding] Character encoding preferences per file type. | ||
---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Andreas Krüger <andreas.krueger> |
Component: | UI | Assignee: | Nick Edgar <n.a.edgar> |
Status: | RESOLVED DUPLICATE | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | kai-uwe_maetzel, Mike_Wilson |
Version: | 2.0 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Description
Andreas Krüger
2002-07-01 06:32:16 EDT
Need to consider improved encoding support post 2.0. Agree that the current story is um... minimal. To do this properly, we should associate an encoding with each resource. There are potentially significant performance issues with doing this however, so we may have to fall back to a simpler strategy (like the one described in this PR). We should begin the discussion early this time. The current encoding support (the parts of it that work) are completely inadequate for XML files. It must be possible to set the encoding on a per-resource basis and to dynamically detect the encoding from file contents. This behavior is required by the standard and certainly every user has the right to expect it of their editor. Worrying that it might cost extra to detect encoding from file contents is simply not productive. However, I can suggest a strategy that will reduce the cost. Implement a rewindable input stream (that buffers the initial contents read up to some limit). Provide that for encoding detection (or other types of file content sniffing) and as the IEditorInput's input stream. This will minimize file and potentially network I/O at the cost of a small buffer which, since InputStreams don't hang around that long, is negligible. For my own XML editor, I allow the user to decide, on a workbench or resource basis, whether to use the default workbench encoding or specify an alternate default encoding for XML files, and orthogonally whether to auto-detect. (The correct default encoding for text and XML files are often different, as XML requires the default encoding to be UTF-8.) |