-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.4.0
-
sparc
-
solaris_7
Name: sdR10048 Date: 12/05/2000
The javadoc for java.awt.datatransfer.DataFlavor says:
public static final DataFlavor selectBestTextFlavor(DataFlavor[] availableFlavors)
Selects the best text DataFlavor from an array of DataFlavors. Only
DataFlavor.stringFlavor, and equivalent flavors, and flavors that
have a primary MIME type of "text", are considered for selection. If
the array contains stringFlavor , or an equivalent flavor (a
serialized java.lang.String ), then this flavor is selected. Flavors
having "text" as their primary MIME type are sorted by their
secondary MIME type in the following order: "plain", "calendar",
"css", "directory", "rfc822-header", "tab-separated-values",
"uri-list", "richtext", "enriched", "rtf", "html", "xml", "sgml". For
example, "text/sgml" will be selected over "text/html", and
"text/enriched" will be selected over "text/richtext". If there are
two or more text flavors with the best MIME subtype in the array,
their charsets are compared. Unicode charsets, such as "UTF-16",
"UTF-8", "UTF-16BE" and "UTF-16LE", are considered best. After them,
platform default charset is selected. "US-ASCII" is worst. All other
charsets are chosen in alphabetical order.
Parameters:
availableFlavors - an array of available DataFlavors
Returns:
the best (highest fidelity) flavor in an encoding supported by
this implementation of the Java platform, or null if none can be
found.
And in the string:
[If there are two or more text flavors with the best MIME subtype in
the array, their charsets are compared.Unicode charsets, such as
"UTF-16", "UTF-8", "UTF-16BE" and "UTF-16LE", are considered best.]
javadoc gives no clarification about what's the method's behaviour if
there are two (or more) "best" flavors with charsets, say, "UTF-16"
and "UTF-8". Currently, "UTF-16" is selected over "UTF-8", "UTF-8" is
selected over "UTF-16BE" and "UTF-16BE" - over "UTF-16LE". If this is
what is expected by developer, this should be specified.
------------------------------------------------------------
======================================================================