1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation. Oracle designates this
7 * particular file as subject to the "Classpath" exception as provided
8 * by Oracle in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24 /*
25 *******************************************************************************
26 * Copyright (C) 2003-2004, International Business Machines Corporation and *
27 * others. All Rights Reserved. *
28 *******************************************************************************
29 */
30 //
31 // CHANGELOG
32 // 2005-05-19 Edward Wang
33 // - copy this file from icu4jsrc_3_2/src/com/ibm/icu/text/Punycode.java
34 // - move from package com.ibm.icu.text to package sun.net.idn
35 // - use ParseException instead of StringPrepParseException
36 // 2007-08-14 Martin Buchholz
37 // - remove redundant casts
38 //
39 package sun.net.idn;
40
41 import java.text.ParseException;
42 import sun.text.normalizer.UCharacter;
43 import sun.text.normalizer.UTF16;
44
45 /**
46 * Ported code from ICU punycode.c
47 * @author ram
48 */
49
50 /* Package Private class */
51 public final class Punycode {
52
53 /* Punycode parameters for Bootstring */
54 private static final int BASE = 36;
55 private static final int TMIN = 1;
56 private static final int TMAX = 26;
57 private static final int SKEW = 38;
58 private static final int DAMP = 700;
59 private static final int INITIAL_BIAS = 72;
60 private static final int INITIAL_N = 0x80;
61
62 /* "Basic" Unicode/ASCII code points */
63 private static final int HYPHEN = 0x2d;
|
1 /*
2 * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 /*
26 *******************************************************************************
27 * Copyright (C) 2003-2004, International Business Machines Corporation and *
28 * others. All Rights Reserved. *
29 *******************************************************************************
30 */
31 //
32 // CHANGELOG
33 // 2005-05-19 Edward Wang
34 // - copy this file from icu4jsrc_3_2/src/com/ibm/icu/text/Punycode.java
35 // - move from package com.ibm.icu.text to package sun.net.idn
36 // - use ParseException instead of StringPrepParseException
37 // 2007-08-14 Martin Buchholz
38 // - remove redundant casts
39 //
40 package jdk.internal.icu.impl;
41
42 import java.text.ParseException;
43 import jdk.internal.icu.lang.UCharacter;
44 import jdk.internal.icu.text.UTF16;
45
46 /**
47 * Ported code from ICU punycode.c
48 * @author ram
49 */
50
51 /* Package Private class */
52 public final class Punycode {
53
54 /* Punycode parameters for Bootstring */
55 private static final int BASE = 36;
56 private static final int TMIN = 1;
57 private static final int TMAX = 26;
58 private static final int SKEW = 38;
59 private static final int DAMP = 700;
60 private static final int INITIAL_BIAS = 72;
61 private static final int INITIAL_N = 0x80;
62
63 /* "Basic" Unicode/ASCII code points */
64 private static final int HYPHEN = 0x2d;
|