8301119: Support for GB18030-2022

Reviewed-by: alanb, coffeys, lancea
This commit is contained in:
Naoto Sato 2023-02-27 16:35:59 +00:00
parent 55e6bb6b85
commit a253b46021
14 changed files with 232 additions and 156 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -58,8 +58,13 @@ public class StandardCharsets extends CharsetProvider {
}
private String canonicalize(String csn) {
String acn = aliasMap().get(csn);
return (acn != null) ? acn : csn;
if (csn.startsWith("gb18030-")) {
return csn.equals("gb18030-2022") && !GB18030.IS_2000 ||
csn.equals("gb18030-2000") && GB18030.IS_2000 ? "gb18030" : csn;
} else {
String acn = aliasMap().get(csn);
return (acn != null) ? acn : csn;
}
}
private Map<String,String> aliasMap() {