Bug 75138 [Encoding] Eclipse's content type support should warn about conflicting settings
According to XML specification, if encoding is not specified in an XML file, XML processors should process the XML file with XML spec default encoding of UTF-8. However, IFile#getCharset() and IFile#getCharset(boolean) search and use user- defined resource encoding as the encoding for the XML file's if it's available. XML files created with user-defined resource encoding may display okay in Eclipse's Text editor. But, other XML processor may not recognize the user- defined resource encoding and may not be able to display some characters in the XML files. Here is one scenario: - change the "Text file encoding" of an existing XML file from default to BIG5 (or other encodings like Shift_JIS) - open the XML file with Eclipse Text editor - remove the encoding="UTF-8" attribute from XML declaration, if there is one - copy some BIG5 characters from a website into the clipboard - paste the BIG5 characters into the XML file - save and re-open the XML file in Eclipse Text editor - the BIG5 characters should display okay in Eclipse Text editor - but, other XML processors (like Internet Explorer) will not be able to display the BIG5 characters in the XML file Eclipse's content type support should provide a way to force the use of default charset if that's the rule for the content type (in this case, for XML).
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceEncodingFieldEditor.java
Group group = super.createEncodingGroup(parent, numColumns);
		String byteOrderLabel = IDEEncoding.getByteOrderMarkLabel(getContentDescription());
		if (byteOrderLabel != null) {
			Label label = new Label(group, SWT.NONE);
			label.setText(IDEWorkbenchMessages.format(
					"WorkbenchPreference.encoding.encodingMessage", 
					new String[] { byteOrderLabel }));
			GridData layoutData = new GridData();
			layoutData.horizontalSpan = numColumns + 1;
			label.setLayoutData(layoutData);
		}
		return group;
	}
	/**
	 * Get the content description of the resource if it is 
	 * a file and it has a content description.
	 * @return IContentDescription or <code>null</code> if resource is
	 * not an IFile or it does not have a descrption.
	 */
	private IContentDescription getContentDescription() {
		try {
			if (resource instanceof IFile)
				return (((IFile) resource).getContentDescription());
		} catch (CoreException exception) {
			
		}
		return null;
	}
}