mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-10 10:28:37 +00:00
4849617: (cs)Revise Charset spec to allow '+' in names
Update the spec and code to accept '+' as a charset name character Reviewed-by: alanb
This commit is contained in:
parent
95008ab775
commit
790bc3042d
@ -85,6 +85,9 @@ import sun.security.action.GetPropertyAction;
|
||||
* <li> The dash character <tt>'-'</tt>
|
||||
* (<tt>'\u002d'</tt>, <small>HYPHEN-MINUS</small>),
|
||||
*
|
||||
* <li> The plus character <tt>'+'</tt>
|
||||
* (<tt>'\u002b'</tt>, <small>PLUS SIGN</small>),
|
||||
*
|
||||
* <li> The period character <tt>'.'</tt>
|
||||
* (<tt>'\u002e'</tt>, <small>FULL STOP</small>),
|
||||
*
|
||||
@ -307,6 +310,7 @@ public abstract class Charset
|
||||
if (c >= 'a' && c <= 'z') continue;
|
||||
if (c >= '0' && c <= '9') continue;
|
||||
if (c == '-' && i != 0) continue;
|
||||
if (c == '+' && i != 0) continue;
|
||||
if (c == ':' && i != 0) continue;
|
||||
if (c == '_' && i != 0) continue;
|
||||
if (c == '.' && i != 0) continue;
|
||||
|
||||
@ -916,7 +916,7 @@ public class ExtendedCharsets
|
||||
"ccsid01140",
|
||||
"cp01140",
|
||||
"1140",
|
||||
// "ebcdic-us-037+euro"
|
||||
"ebcdic-us-037+euro"
|
||||
});
|
||||
|
||||
charset("IBM01141", "IBM1141",
|
||||
@ -925,7 +925,7 @@ public class ExtendedCharsets
|
||||
"ccsid01141",
|
||||
"cp01141",
|
||||
"1141",
|
||||
// "ebcdic-de-273+euro"
|
||||
"ebcdic-de-273+euro"
|
||||
});
|
||||
|
||||
charset("IBM01142", "IBM1142",
|
||||
@ -934,8 +934,8 @@ public class ExtendedCharsets
|
||||
"ccsid01142",
|
||||
"cp01142",
|
||||
"1142",
|
||||
// "ebcdic-no-277+euro",
|
||||
// "ebcdic-dk-277+euro"
|
||||
"ebcdic-no-277+euro",
|
||||
"ebcdic-dk-277+euro"
|
||||
});
|
||||
|
||||
charset("IBM01143", "IBM1143",
|
||||
@ -944,8 +944,8 @@ public class ExtendedCharsets
|
||||
"ccsid01143",
|
||||
"cp01143",
|
||||
"1143",
|
||||
// "ebcdic-fi-278+euro",
|
||||
// "ebcdic-se-278+euro"
|
||||
"ebcdic-fi-278+euro",
|
||||
"ebcdic-se-278+euro"
|
||||
});
|
||||
|
||||
charset("IBM01144", "IBM1144",
|
||||
@ -954,7 +954,7 @@ public class ExtendedCharsets
|
||||
"ccsid01144",
|
||||
"cp01144",
|
||||
"1144",
|
||||
// "ebcdic-it-280+euro"
|
||||
"ebcdic-it-280+euro"
|
||||
});
|
||||
|
||||
charset("IBM01145", "IBM1145",
|
||||
@ -963,7 +963,7 @@ public class ExtendedCharsets
|
||||
"ccsid01145",
|
||||
"cp01145",
|
||||
"1145",
|
||||
// "ebcdic-es-284+euro"
|
||||
"ebcdic-es-284+euro"
|
||||
});
|
||||
|
||||
charset("IBM01146", "IBM1146",
|
||||
@ -972,7 +972,7 @@ public class ExtendedCharsets
|
||||
"ccsid01146",
|
||||
"cp01146",
|
||||
"1146",
|
||||
// "ebcdic-gb-285+euro"
|
||||
"ebcdic-gb-285+euro"
|
||||
});
|
||||
|
||||
charset("IBM01147", "IBM1147",
|
||||
@ -981,7 +981,7 @@ public class ExtendedCharsets
|
||||
"ccsid01147",
|
||||
"cp01147",
|
||||
"1147",
|
||||
// "ebcdic-fr-277+euro"
|
||||
"ebcdic-fr-277+euro"
|
||||
});
|
||||
|
||||
charset("IBM01148", "IBM1148",
|
||||
@ -990,7 +990,7 @@ public class ExtendedCharsets
|
||||
"ccsid01148",
|
||||
"cp01148",
|
||||
"1148",
|
||||
// "ebcdic-international-500+euro"
|
||||
"ebcdic-international-500+euro"
|
||||
});
|
||||
|
||||
charset("IBM01149", "IBM1149",
|
||||
@ -999,7 +999,7 @@ public class ExtendedCharsets
|
||||
"ccsid01149",
|
||||
"cp01149",
|
||||
"1149",
|
||||
// "ebcdic-s-871+euro"
|
||||
"ebcdic-s-871+euro"
|
||||
});
|
||||
|
||||
// Macintosh MacOS/Apple char encodingd
|
||||
|
||||
@ -314,6 +314,7 @@ charset IBM00858 IBM858
|
||||
alias ccsid00858
|
||||
alias cp00858
|
||||
alias 858
|
||||
alias PC-Multilingual-850+euro
|
||||
|
||||
charset IBM862 IBM862
|
||||
alias cp862 #JDK historical
|
||||
|
||||
58
jdk/test/sun/nio/cs/CheckICNE.java
Normal file
58
jdk/test/sun/nio/cs/CheckICNE.java
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/* @test
|
||||
@bug 4849617
|
||||
@summary Checks "+" is a legal character for charset name
|
||||
*/
|
||||
import java.nio.charset.*;
|
||||
|
||||
public class CheckICNE {
|
||||
static int failed = 0;
|
||||
public static void main (String[] args) throws Exception {
|
||||
try {
|
||||
Charset.forName("abc+");
|
||||
} catch (UnsupportedCharsetException uce) {}
|
||||
|
||||
try {
|
||||
java.nio.charset.Charset.forName("+abc");
|
||||
} catch (IllegalCharsetNameException icne) {}
|
||||
|
||||
String[] euros = {"PC-Multilingual-850+euro",
|
||||
"ebcdic-us-037+euro",
|
||||
"ebcdic-de-273+euro",
|
||||
"ebcdic-no-277+euro",
|
||||
"ebcdic-dk-277+euro",
|
||||
"ebcdic-fi-278+euro",
|
||||
"ebcdic-se-278+euro",
|
||||
"ebcdic-it-280+euro",
|
||||
"ebcdic-es-284+euro",
|
||||
"ebcdic-gb-285+euro",
|
||||
"ebcdic-fr-277+euro",
|
||||
"ebcdic-international-500+euro",
|
||||
"ebcdic-s-871+euro"
|
||||
};
|
||||
|
||||
System.out.println("Test Passed!");
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user