jdk/src/share/classes/sun/nio/cs/ext/HKSCS.java
author sherman
Tue, 28 May 2013 10:42:52 -0700
changeset 17723 ae7be7852a99
parent 14342 8435a30053c1
child 23010 6dadb192ad81
permissions -rw-r--r--
8001750: CharsetDecoder.replacement should not be changeable except via replaceWith method Summary: to make defensive copy for set/get replacement byte array Reviewed-by: martin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 13257
diff changeset
     2
 * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5167
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5167
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5167
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5167
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5167
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.nio.cs.ext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    28
import java.nio.ByteBuffer;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    29
import java.nio.CharBuffer;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.nio.charset.Charset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.nio.charset.CharsetDecoder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.nio.charset.CharsetEncoder;
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    33
import java.nio.charset.CoderResult;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    34
import java.util.Arrays;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    35
import sun.nio.cs.Surrogate;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    36
import static sun.nio.cs.CharsetMapping.*;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    38
public class HKSCS {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    39
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    40
    public static class Decoder extends DoubleByte.Decoder {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    41
        static int b2Min = 0x40;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    42
        static int b2Max = 0xfe;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    43
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    44
        private char[][] b2cBmp;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    45
        private char[][] b2cSupp;
5785
5dfabe612d10 6959197: When building with JAVAC_MAX_WARNINGS=true, the build fails in sun/nio/cs due to the use of -Werror
andrew
parents: 5506
diff changeset
    46
        private DoubleByte.Decoder big5Dec;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    48
        protected Decoder(Charset cs,
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    49
                          DoubleByte.Decoder big5Dec,
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    50
                          char[][] b2cBmp, char[][] b2cSupp)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    51
        {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    52
            // super(cs, 0.5f, 1.0f);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    53
            // need to extends DoubleByte.Decoder so the
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    54
            // sun.io can use it. this implementation
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    55
            super(cs, 0.5f, 1.0f, null, null, 0, 0);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    56
            this.big5Dec = big5Dec;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    57
            this.b2cBmp = b2cBmp;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    58
            this.b2cSupp = b2cSupp;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    59
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    61
        public char decodeSingle(int b) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    62
            return big5Dec.decodeSingle(b);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    63
        }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    64
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    65
        public char decodeBig5(int b1, int b2) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    66
            return big5Dec.decodeDouble(b1, b2);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    67
        }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    68
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    69
        public char decodeDouble(int b1, int b2) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    70
            return b2cBmp[b1][b2 - b2Min];
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    71
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    73
        public char decodeDoubleEx(int b1, int b2) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    74
            /* if the b2cSupp is null, the subclass need
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    75
               to override the methold
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    76
            if (b2cSupp == null)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    77
                return UNMAPPABLE_DECODING;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    78
             */
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    79
            return b2cSupp[b1][b2 - b2Min];
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    80
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    82
        protected CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    83
            byte[] sa = src.array();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    84
            int sp = src.arrayOffset() + src.position();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    85
            int sl = src.arrayOffset() + src.limit();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    86
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    87
            char[] da = dst.array();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    88
            int dp = dst.arrayOffset() + dst.position();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    89
            int dl = dst.arrayOffset() + dst.limit();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    91
            try {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    92
                while (sp < sl) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    93
                    int b1 = sa[sp] & 0xff;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    94
                    char c = decodeSingle(b1);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    95
                    int inSize = 1, outSize = 1;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    96
                    char[] cc = null;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    97
                    if (c == UNMAPPABLE_DECODING) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    98
                        if (sl - sp < 2)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
    99
                            return CoderResult.UNDERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   100
                        int b2 = sa[sp + 1] & 0xff;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   101
                        inSize++;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   102
                        if (b2 < b2Min || b2 > b2Max)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   103
                            return CoderResult.unmappableForLength(2);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   104
                        c = decodeDouble(b1, b2);           //bmp
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   105
                        if (c == UNMAPPABLE_DECODING) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   106
                            c = decodeDoubleEx(b1, b2);     //supp
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   107
                            if (c == UNMAPPABLE_DECODING) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   108
                                c = decodeBig5(b1, b2);     //big5
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   109
                                if (c == UNMAPPABLE_DECODING)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   110
                                    return CoderResult.unmappableForLength(2);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   111
                            } else {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   112
                                // supplementary character in u+2xxxx area
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   113
                                outSize = 2;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   114
                            }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   115
                        }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   116
                    }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   117
                    if (dl - dp < outSize)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   118
                        return CoderResult.OVERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   119
                    if (outSize == 2) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   120
                        // supplementary characters
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   121
                        da[dp++] = Surrogate.high(0x20000 + c);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   122
                        da[dp++] = Surrogate.low(0x20000 + c);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   123
                    } else {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   124
                        da[dp++] = c;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   125
                    }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   126
                    sp += inSize;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   127
                }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   128
                return CoderResult.UNDERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   129
            } finally {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   130
                src.position(sp - src.arrayOffset());
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   131
                dst.position(dp - dst.arrayOffset());
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   132
            }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   133
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   135
        protected CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   136
            int mark = src.position();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   137
            try {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   138
                while (src.hasRemaining()) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   139
                    char[] cc = null;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   140
                    int b1 = src.get() & 0xff;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   141
                    int inSize = 1, outSize = 1;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   142
                    char c = decodeSingle(b1);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   143
                    if (c == UNMAPPABLE_DECODING) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   144
                        if (src.remaining() < 1)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   145
                            return CoderResult.UNDERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   146
                        int b2 = src.get() & 0xff;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   147
                        inSize++;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   148
                        if (b2 < b2Min || b2 > b2Max)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   149
                            return CoderResult.unmappableForLength(2);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   150
                        c = decodeDouble(b1, b2);           //bmp
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   151
                        if (c == UNMAPPABLE_DECODING) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   152
                            c = decodeDoubleEx(b1, b2);     //supp
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   153
                            if (c == UNMAPPABLE_DECODING) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   154
                                c = decodeBig5(b1, b2);     //big5
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   155
                                if (c == UNMAPPABLE_DECODING)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   156
                                    return CoderResult.unmappableForLength(2);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   157
                            } else {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   158
                                outSize = 2;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   159
                            }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   160
                        }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   161
                    }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   162
                    if (dst.remaining() < outSize)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   163
                        return CoderResult.OVERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   164
                    if (outSize == 2) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   165
                        dst.put(Surrogate.high(0x20000 + c));
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   166
                        dst.put(Surrogate.low(0x20000 + c));
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   167
                    } else {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   168
                        dst.put(c);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   169
                    }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   170
                    mark += inSize;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   171
                }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   172
                return CoderResult.UNDERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   173
            } finally {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   174
                src.position(mark);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   175
            }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   176
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
13257
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   178
        public int decode(byte[] src, int sp, int len, char[] dst) {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   179
            int dp = 0;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   180
            int sl = sp + len;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   181
            char repl = replacement().charAt(0);
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   182
            while (sp < sl) {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   183
                int b1 = src[sp++] & 0xff;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   184
                char c = decodeSingle(b1);
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   185
                if (c == UNMAPPABLE_DECODING) {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   186
                    if (sl == sp) {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   187
                        c = repl;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   188
                    } else {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   189
                        int b2 = src[sp++] & 0xff;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   190
                        if (b2 < b2Min || b2 > b2Max) {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   191
                            c = repl;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   192
                        } else if ((c = decodeDouble(b1, b2)) == UNMAPPABLE_DECODING) {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   193
                            c = decodeDoubleEx(b1, b2);     //supp
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   194
                            if (c == UNMAPPABLE_DECODING) {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   195
                                c = decodeBig5(b1, b2);     //big5
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   196
                                if (c == UNMAPPABLE_DECODING)
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   197
                                    c = repl;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   198
                            } else {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   199
                                // supplementary character in u+2xxxx area
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   200
                                dst[dp++] = Surrogate.high(0x20000 + c);
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   201
                                dst[dp++] = Surrogate.low(0x20000 + c);
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   202
                                continue;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   203
                            }
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   204
                        }
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   205
                    }
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   206
                }
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   207
                dst[dp++] = c;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   208
            }
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   209
            return dp;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   210
        }
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   211
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   212
        public CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   213
            if (src.hasArray() && dst.hasArray())
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   214
                return decodeArrayLoop(src, dst);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   215
            else
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   216
                return decodeBufferLoop(src, dst);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   217
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   219
        static void initb2c(char[][]b2c, String[] b2cStr)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   220
        {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   221
            for (int i = 0; i < b2cStr.length; i++) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   222
                if (b2cStr[i] == null)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   223
                    b2c[i] = DoubleByte.B2C_UNMAPPABLE;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   224
                else
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   225
                    b2c[i] = b2cStr[i].toCharArray();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   226
            }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   227
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   231
    public static class Encoder extends DoubleByte.Encoder {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   232
        private DoubleByte.Encoder big5Enc;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   233
        private char[][] c2bBmp;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   234
        private char[][] c2bSupp;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   236
        protected Encoder(Charset cs,
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   237
                          DoubleByte.Encoder big5Enc,
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   238
                          char[][] c2bBmp,
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   239
                          char[][] c2bSupp)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   240
        {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   241
            super(cs, null, null);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   242
            this.big5Enc = big5Enc;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   243
            this.c2bBmp = c2bBmp;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   244
            this.c2bSupp = c2bSupp;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   245
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   247
        public int encodeBig5(char ch) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   248
            return big5Enc.encodeChar(ch);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   249
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   251
        public int encodeChar(char ch) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   252
            int bb = c2bBmp[ch >> 8][ch & 0xff];
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   253
            if (bb == UNMAPPABLE_ENCODING)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   254
                return encodeBig5(ch);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   255
            return bb;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   256
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   258
        public int encodeSupp(int cp) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   259
            if ((cp & 0xf0000) != 0x20000)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   260
                return UNMAPPABLE_ENCODING;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   261
            return c2bSupp[(cp >> 8) & 0xff][cp & 0xff];
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   262
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   264
        public boolean canEncode(char c) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   265
            return encodeChar(c) != UNMAPPABLE_ENCODING;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   268
        protected CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   269
            char[] sa = src.array();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   270
            int sp = src.arrayOffset() + src.position();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   271
            int sl = src.arrayOffset() + src.limit();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   272
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   273
            byte[] da = dst.array();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   274
            int dp = dst.arrayOffset() + dst.position();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   275
            int dl = dst.arrayOffset() + dst.limit();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   277
            try {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   278
                while (sp < sl) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   279
                    char c = sa[sp];
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   280
                    int inSize = 1;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   281
                    int bb = encodeChar(c);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   282
                    if (bb == UNMAPPABLE_ENCODING) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   283
                        if (Character.isSurrogate(c)) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   284
                            int cp;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   285
                            if ((cp = sgp().parse(c, sa, sp, sl)) < 0)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   286
                                return sgp.error();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   287
                            bb = encodeSupp(cp);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   288
                            if (bb == UNMAPPABLE_ENCODING)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   289
                                return CoderResult.unmappableForLength(2);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   290
                            inSize = 2;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   291
                        } else {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   292
                            return CoderResult.unmappableForLength(1);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   293
                        }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   294
                    }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   295
                    if (bb > MAX_SINGLEBYTE) {    // DoubleByte
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   296
                        if (dl - dp < 2)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   297
                            return CoderResult.OVERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   298
                        da[dp++] = (byte)(bb >> 8);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   299
                        da[dp++] = (byte)bb;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   300
                    } else {                      // SingleByte
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   301
                        if (dl - dp < 1)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   302
                            return CoderResult.OVERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   303
                        da[dp++] = (byte)bb;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   304
                    }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   305
                    sp += inSize;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   306
                }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   307
                return CoderResult.UNDERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   308
            } finally {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   309
                src.position(sp - src.arrayOffset());
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   310
                dst.position(dp - dst.arrayOffset());
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   311
            }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   312
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   314
        protected CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   315
            int mark = src.position();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   316
            try {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   317
                while (src.hasRemaining()) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   318
                    int inSize = 1;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   319
                    char c = src.get();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   320
                    int bb = encodeChar(c);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   321
                    if (bb == UNMAPPABLE_ENCODING) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   322
                        if (Character.isSurrogate(c)) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   323
                            int cp;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   324
                            if ((cp = sgp().parse(c, src)) < 0)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   325
                                return sgp.error();
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   326
                            bb = encodeSupp(cp);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   327
                            if (bb == UNMAPPABLE_ENCODING)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   328
                                return CoderResult.unmappableForLength(2);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   329
                            inSize = 2;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   330
                        } else {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   331
                            return CoderResult.unmappableForLength(1);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   332
                        }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   333
                    }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   334
                    if (bb > MAX_SINGLEBYTE) {  // DoubleByte
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   335
                        if (dst.remaining() < 2)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   336
                            return CoderResult.OVERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   337
                        dst.put((byte)(bb >> 8));
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   338
                        dst.put((byte)(bb));
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   339
                    } else {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   340
                        if (dst.remaining() < 1)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   341
                        return CoderResult.OVERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   342
                        dst.put((byte)bb);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   343
                    }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   344
                    mark += inSize;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   345
                }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   346
                return CoderResult.UNDERFLOW;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   347
            } finally {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   348
                src.position(mark);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   349
            }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   350
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   352
        protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   353
            if (src.hasArray() && dst.hasArray())
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   354
                return encodeArrayLoop(src, dst);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   355
            else
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   356
                return encodeBufferLoop(src, dst);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   357
        }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   358
17723
ae7be7852a99 8001750: CharsetDecoder.replacement should not be changeable except via replaceWith method
sherman
parents: 14342
diff changeset
   359
        private byte[] repl = replacement();
ae7be7852a99 8001750: CharsetDecoder.replacement should not be changeable except via replaceWith method
sherman
parents: 14342
diff changeset
   360
        protected void implReplaceWith(byte[] newReplacement) {
ae7be7852a99 8001750: CharsetDecoder.replacement should not be changeable except via replaceWith method
sherman
parents: 14342
diff changeset
   361
            repl = newReplacement;
ae7be7852a99 8001750: CharsetDecoder.replacement should not be changeable except via replaceWith method
sherman
parents: 14342
diff changeset
   362
        }
ae7be7852a99 8001750: CharsetDecoder.replacement should not be changeable except via replaceWith method
sherman
parents: 14342
diff changeset
   363
13257
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   364
        public int encode(char[] src, int sp, int len, byte[] dst) {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   365
            int dp = 0;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   366
            int sl = sp + len;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   367
            while (sp < sl) {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   368
                char c = src[sp++];
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   369
                int bb = encodeChar(c);
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   370
                if (bb == UNMAPPABLE_ENCODING) {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   371
                    if (!Character.isHighSurrogate(c) || sp == sl ||
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   372
                        !Character.isLowSurrogate(src[sp]) ||
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   373
                        (bb = encodeSupp(Character.toCodePoint(c, src[sp++])))
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   374
                        == UNMAPPABLE_ENCODING) {
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   375
                        dst[dp++] = repl[0];
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   376
                        if (repl.length > 1)
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   377
                            dst[dp++] = repl[1];
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   378
                        continue;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   379
                    }
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   380
                    sp++;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   381
                }
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   382
                if (bb > MAX_SINGLEBYTE) {        // DoubleByte
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   383
                    dst[dp++] = (byte)(bb >> 8);
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   384
                    dst[dp++] = (byte)bb;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   385
                } else {                          // SingleByte
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   386
                    dst[dp++] = (byte)bb;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   387
                }
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   388
            }
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   389
            return dp;
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   390
        }
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   391
5cf4ff2cbb37 7183053: Optimize DoubleByte charset for String.getBytes()/new String(byte[])
sherman
parents: 5785
diff changeset
   392
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   393
        static char[] C2B_UNMAPPABLE = new char[0x100];
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   394
        static {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   395
            Arrays.fill(C2B_UNMAPPABLE, (char)UNMAPPABLE_ENCODING);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   396
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   398
       static void initc2b(char[][] c2b, String[] b2cStr, String pua) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   399
            // init c2b/c2bSupp from b2cStr and supp
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   400
            int b2Min = 0x40;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   401
            Arrays.fill(c2b, C2B_UNMAPPABLE);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   402
            for (int b1 = 0; b1 < 0x100; b1++) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   403
                String s = b2cStr[b1];
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   404
                if (s == null)
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   405
                    continue;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   406
                for (int i = 0; i < s.length(); i++) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   407
                    char c = s.charAt(i);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   408
                    int hi = c >> 8;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   409
                    if (c2b[hi] == C2B_UNMAPPABLE) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   410
                        c2b[hi] = new char[0x100];
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   411
                        Arrays.fill(c2b[hi], (char)UNMAPPABLE_ENCODING);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   412
                    }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   413
                    c2b[hi][c & 0xff] = (char)((b1 << 8) | (i + b2Min));
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   414
                }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   415
            }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   416
            if (pua != null) {        // add the compatibility pua entries
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   417
                char c = '\ue000';    //first pua character
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   418
                for (int i = 0; i < pua.length(); i++) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   419
                    char bb = pua.charAt(i);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   420
                    if (bb != UNMAPPABLE_DECODING) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   421
                        int hi = c >> 8;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   422
                        if (c2b[hi] == C2B_UNMAPPABLE) {
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   423
                            c2b[hi] = new char[0x100];
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   424
                            Arrays.fill(c2b[hi], (char)UNMAPPABLE_ENCODING);
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   425
                        }
5785
5dfabe612d10 6959197: When building with JAVAC_MAX_WARNINGS=true, the build fails in sun/nio/cs due to the use of -Werror
andrew
parents: 5506
diff changeset
   426
                        c2b[hi][c & 0xff] = bb;
5167
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   427
                    }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   428
                    c++;
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   429
                }
dbd299f8fdae 6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents: 2
diff changeset
   430
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
}