-
Notifications
You must be signed in to change notification settings - Fork 219
8301119: Support for GB18030-2022 #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ | |
| import java.util.Locale; | ||
| import java.util.Map; | ||
| import sun.misc.ASCIICaseInsensitiveComparator; | ||
|
|
||
| import sun.nio.cs.ext.GB18030; | ||
|
|
||
| /** | ||
| * Abstract base class for charset providers. | ||
|
|
@@ -115,9 +115,14 @@ protected void deleteCharset(String name, String[] aliases) { | |
| */ | ||
| protected void init() { } | ||
|
|
||
| private String canonicalize(String charsetName) { | ||
| String acn = aliasMap.get(charsetName); | ||
| return (acn != null) ? acn : charsetName; | ||
| private String canonicalize(String 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; | ||
| } | ||
|
Comment on lines
+118
to
+125
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe if we hooked into the late initialization hook instead we wouldn't need this canonicalization as the |
||
| } | ||
|
|
||
| private Charset lookup(String csn) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. | ||
| * Copyright (c) 2002, 2023, Oracle and/or its affiliates. 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 | ||
|
|
@@ -25,9 +25,6 @@ | |
|
|
||
| package sun.nio.cs.ext; | ||
|
|
||
| import java.lang.ref.SoftReference; | ||
| import java.nio.charset.Charset; | ||
| import java.nio.charset.spi.CharsetProvider; | ||
| import sun.nio.cs.AbstractCharsetProvider; | ||
| import java.security.AccessController; | ||
| import sun.security.action.GetPropertyAction; | ||
|
|
@@ -117,7 +114,7 @@ public ExtendedCharsets() { | |
|
|
||
| charset("GB18030", "GB18030", | ||
| new String[] { | ||
| "gb18030-2000" | ||
| GB18030.IS_2000 ? "gb18030-2000" : "gb18030-2022" | ||
|
Comment on lines
115
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This initialization will be wrong when run with |
||
| }); | ||
|
|
||
| charset("GB2312", "EUC_CN", | ||
|
|
||
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on
GB18030class (sun.nio.cs.ext.incharsets.jar) in packagesun.nio.cs(rt.jar) seems worrisome.