diff --git a/serializer/src/main/java/org/apache/xml/serializer/Encodings.java b/serializer/src/main/java/org/apache/xml/serializer/Encodings.java index 00dd8ea04..b57db504c 100644 --- a/serializer/src/main/java/org/apache/xml/serializer/Encodings.java +++ b/serializer/src/main/java/org/apache/xml/serializer/Encodings.java @@ -36,6 +36,12 @@ /** * Provides information about encodings. Depends on the Java runtime * to provides writers for the different encodings. + * + * NOTE: When a Java or MIME names appears more than once in the + * encodings.properties table, priority is given to the first instance + * seen. For example, MIME name ISO-8859-1 will be mapped to Java name + * ISO8859-1, even though the file includes synonyms such as ISO8859_1 + * and 8859-1. *

* This class is not a public API. It is only public because it * is used outside of this package. @@ -369,9 +375,9 @@ private static EncodingInfo[] loadEncodingInfo() mimeName = st.nextToken(); EncodingInfo ei = new EncodingInfo(mimeName, javaName, highChar); encodingInfo_list.add(ei); - _encodingTableKeyMime.put(mimeName.toUpperCase(), ei); + _encodingTableKeyMime.putIfAbsent(mimeName.toUpperCase(), ei); if (first) - _encodingTableKeyJava.put(javaName.toUpperCase(), ei); + _encodingTableKeyJava.putIfAbsent(javaName.toUpperCase(), ei); } } } diff --git a/serializer/src/main/resources/org/apache/xml/serializer/Encodings.properties b/serializer/src/main/resources/org/apache/xml/serializer/Encodings.properties index f1da1dbc1..c1e3d8fcc 100644 --- a/serializer/src/main/resources/org/apache/xml/serializer/Encodings.properties +++ b/serializer/src/main/resources/org/apache/xml/serializer/Encodings.properties @@ -37,6 +37,9 @@ # Higher values above this char might be in the encoding, although in the # case of this particular encoding there are no higher chars. # +# NOTE: When a Java or MIME names appears more than once in this +# table, priority is given to the first instance seen. For example, +# MIME name ISO-8859-1 will be mapped to Java name ISO8859-1. # # , #