Repository: logging-log4j2 Updated Branches: refs/heads/master 4457121ce -> 85bc8a50a
[LOG4J2-2053] Exception java.nio.charset.UnsupportedCharsetException: cp65001 in 2.9.0 Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/85bc8a50 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/85bc8a50 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/85bc8a50 Branch: refs/heads/master Commit: 85bc8a50a03278567dfdfe58acf2f31a9211832a Parents: 4457121 Author: Gary Gregory <[email protected]> Authored: Mon Oct 9 11:36:38 2017 -0600 Committer: Gary Gregory <[email protected]> Committed: Mon Oct 9 11:36:38 2017 -0600 ---------------------------------------------------------------------- .../main/resources/Log4j-charsets.properties | 8 +++++ .../logging/log4j/util/CharsetForNameMain.java | 37 ++++++++++++++++++++ 2 files changed, 45 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/85bc8a50/log4j-api/src/main/resources/Log4j-charsets.properties ---------------------------------------------------------------------- diff --git a/log4j-api/src/main/resources/Log4j-charsets.properties b/log4j-api/src/main/resources/Log4j-charsets.properties index 344ac7d..22f7be8 100644 --- a/log4j-api/src/main/resources/Log4j-charsets.properties +++ b/log4j-api/src/main/resources/Log4j-charsets.properties @@ -1 +1,9 @@ +# Mapping based on https://msdn.microsoft.com/en-us/en-en/library/windows/desktop/dd317756(v=vs.85).aspx cp65001 = UTF-8 +cp20127 = US-ASCII +cp54936 = gb18030 +cp28592 = iso-8859-2 +cp28593 = iso-8859-3 +cp28594 = iso-8859-4 +cp28595 = iso-8859-5 +cp28596 = iso-8859-6 http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/85bc8a50/log4j-api/src/test/java/org/apache/logging/log4j/util/CharsetForNameMain.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/CharsetForNameMain.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/CharsetForNameMain.java new file mode 100644 index 0000000..c4ffd95 --- /dev/null +++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/CharsetForNameMain.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ + +package org.apache.logging.log4j.util; + +import java.nio.charset.Charset; + +public class CharsetForNameMain { + + /** + * Checks that the given Charset names can be loaded. + */ + public static void main(String[] args) { + for (String charsetName : args) { + if (Charset.isSupported(charsetName)) { + System.out + .println(String.format("%s aliases: %s", charsetName, Charset.forName(charsetName).aliases())); + } else { + System.out.println("Cannot load " + charsetName); + } + } + } +}
