Bug 22016 - [encoding] Inconsistent UI for text encoding
Summary: [encoding] Inconsistent UI for text encoding
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M2   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: investigate
Depends on: 34421
Blocks: 20641 21195
  Show dependency tree
 
Reported: 2002-07-29 15:36 EDT by Tod Creasey CLA
Modified: 2004-09-21 14:52 EDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2002-07-29 15:36:36 EDT
20020723

The names of all of the encodings is shown differently in the pull down menu 
and on the preference page. Specifically Latin 1 is on the pulldown and ISO-
8859-1 is shown on the preference page. I think the preference page is the 
better choice.
Comment 1 Nick Edgar CLA 2002-07-29 15:46:13 EDT
I actually prefer the Edit / Encoding presentation since it is more user-
friendly.  Compare with IE's encoding menu.

However, I know of no way of getting human-readable names for encodings through 
standard Java API.  If there is no way to do this with generic API, we should 
just hardwire a bunch of names like IE, and translate them.  We should at least 
include encodings for the main locales we support.  

Better yet would be a way to extend the list.  E.g. the Japanese translation 
fragments could add the Japanese encoding(s).
Comment 2 Tod Creasey CLA 2002-07-30 09:08:12 EDT
Are the encodings the sort of thing that translators should handle? I think we 
might want to do it like we do with the key bindings - i.e. add an extension 
point for encodings that has an optional locale tag and define a few of those 
we know about with the option for fragments to extends.

Something like

<fileencodings id="defaultencodings"
         <fileencoding id="Latin-1" /fileencoding>
         <fileencoding id="GBK" locale="ja" /fileencoding>
<fileencodings>
Comment 3 Nick Edgar CLA 2002-07-30 14:28:43 EDT
Yes, something like that.  We should have a good basic set, and translation 
fragments could add more.
Comment 4 Tod Creasey CLA 2002-08-06 14:04:20 EDT
Fixed in Stream TC_ENCODING. Will be released pending approval by Kai.
Comment 5 Bob Foster CLA 2002-08-09 23:10:49 EDT
Java already supports a large number of encodings that aren't on your list.

It would be better to use the IANA names for encodings in the UI and the Java
names only internally.
Comment 6 Tod Creasey CLA 2002-08-28 14:37:28 EDT
When the encoding changes are released we can see what other additions we are 
after.

The new encoding work has the concept of a label (which is what the user sees) 
and a value (the actual encoding value java would use) which should address 
your concerns. 

Here is an example of the plugin.xml

<extension
         point="org.eclipse.ui.fileEncodings">
       <fileEncoding
            id="GB18030"
            label= "%FileEncoding.GB18030"
            value="GB18030"
            helpContextId="GB18030_action_context"
            description="%FileEncoding.GB18030.description"
            tooltip="%FileEncoding.GB18030.tooltip"
            locale="zh_CW">
      </fileEncoding>
      <fileEncoding
            id="GBK"
            label="%FileEncoding.GBK"
            value="GBK"
            helpContextId="GBK_action_context"
            description="%FileEncoding.GBK.description"
            tooltip="%FileEncoding.GBK.tooltip"
            locale="zh">
      </fileEncoding>
      <fileEncoding
            id="ISO-8859-1"
            label="%FileEncoding.ISO-8859-1"
            helpContextId="ISO-8859-1_action_context"
            description="%FileEncoding.ISO-8859-1.description"
            tooltip="%FileEncoding.ISO-8859-1.tooltip"
            value="ISO-8859-1">
      </fileEncoding>
       <fileEncoding
            id="UTF-8"
            label="%FileEncoding.UTF-8"
            helpContextId="UTF-8_action_context"
            description="%FileEncoding.UTF-8.description"
            tooltip="%FileEncoding.UTF-8.tooltip"
            value="UTF-8">
      </fileEncoding>
      <fileEncoding
            id="UTF-16"
            label="%FileEncoding.UTF-16"
            helpContextId="UTF-16_action_context"
            description="%FileEncoding.UTF-16.description"
            tooltip="%FileEncoding.UTF-16.tooltip"
            value="UTF-16">
      </fileEncoding>
      <fileEncoding
            id="UTF-16BE"
            label="%FileEncoding.UTF-16BE"
            helpContextId="UTF-16BE_action_context"
            description="%FileEncoding.UTF-16BE.description"
            tooltip="%FileEncoding.UTF-16BE.tooltip"
            value="UTF-16BE">
      </fileEncoding>
      <fileEncoding
            id="UTF-16LE"
            label="%FileEncoding.UTF-16LE"
            helpContextId="UTF-16LE_action_context"
            description="%FileEncoding.UTF-16LE.description"
            tooltip="%FileEncoding.UTF-16LE.tooltip"
            value="UTF-16LE">
      </fileEncoding>
      <fileEncoding
            id="US-ASCII"
            label="%FileEncoding.US-ASCII"
            helpContextId="US-ASCII_action_context"
            description="%FileEncoding.US-ASCII.description"
            tooltip="%FileEncoding.US-ASCII.tooltip"
            value="US-ASCII">
      </fileEncoding>
     
   </extension>

Comment 7 Bob Foster CLA 2002-08-28 23:56:11 EDT
I'm hopeful. But it sure won't address my concern if Eclipse has its own set of
encoding labels, different than IANA or Java. ;-} It's all very well to define
the labels in XML, but if it's like the keyboard shortcuts, they all tend to go
in platform.ui where plugins and users have very little say in the matter.

What is locale= used for? Is there any design document for the encoding changes?

I hope it's realized that when it comes to encoding one size does not fit all.
For example, auto-detection is mandatory for XML. I basically disabled the
current encoding support for my XML editor (took it out of the menu, overrode
the document provider). The only part left is the workplace default encoding,
which a user can choose to use as a preference option.
Comment 8 Tod Creasey CLA 2002-08-29 07:28:55 EDT
The locale tag is for encodings that are only relevant in certain locales 
(like GB18030 in Simplified Chinese).
Comment 9 Bob Foster CLA 2002-08-29 20:01:50 EDT
How do you know in what locales an encoding is relevant? Put another way, how do
you know that the Unicode support in some platform isn't sufficiently strong to
display these encodings, regardless of the locale?
Comment 10 Tod Creasey CLA 2002-08-30 07:36:36 EDT
It is more a question of what we add as code pages by default - you can add in 
a locale by typing the encoding into the preference page. Removing code pages 
that are not generally interesting outside of a particular locale (like 
GB18030) is just a way of reducing the list size.
Comment 11 Bob Foster CLA 2002-08-30 08:01:36 EDT
That makes sense but it seems to add work to do it right. That means that once
the user has ever specified an encoding not in the default list it should
thereafter appear in the list, which means it has to be saved somewhere, etc.

(But you always have to allow for encodings you don't know about, so maybe that
just goes with the territory.)

The next shoe to drop will be someone wanting an option to see the entire list
rather than have to type in an encoding with the attendant possibility of error.

BTW, is there any design document about the encoding changes?
Comment 12 Tod Creasey CLA 2002-08-30 08:19:35 EDT
The changes described here are just a simple UI addition - the encoding is due 
to be revisited as a whole soon - there should be documentation forthcoming 
then.
Comment 13 Dani Megert CLA 2004-08-27 09:36:04 EDT
There's now API (WorkbenchEncoding and IDEEncoding) to get a list of encodings
(see bug 34421). To adopt this we need to:
- remove our hard-coded encoding commands
- deprecate the constants
- replace the constants with dynamic values
Comment 14 Dani Megert CLA 2004-09-21 14:52:06 EDT
We no longer provide custom encoding change actions in the editor. Instead we
retarget the PROPERTIES command (open properties dialog) which allows to change
the encoding. In addition we provide a Change Encoding... action which uses the
Platform UI's ResourceEncodingFieldEditor.

This has been committed to HEAD.
Released into I200409211600