gnu.inet.encoding

Class IDNA


public class IDNA
extends java.lang.Object

Copyright (C) 2004 Free Software Foundation, Inc. Author: Oliver Hitz This file is part of GNU Libidn. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Field Summary

static String
ACE_PREFIX

Method Summary

static String
toASCII(String input)
Converts a Unicode string to ASCII using the procedure in RFC3490 section 4.1.
static String
toASCII(String input, boolean allowUnassigned, boolean useSTD3ASCIIRules)
Converts a Unicode string to ASCII using the procedure in RFC3490 section 4.1.
static String
toUnicode(String input)
Converts an ASCII-encoded string to Unicode.
static String
toUnicode(String input, boolean allowUnassigned, boolean useSTD3ASCIIRules)
Converts an ASCII-encoded string to Unicode.

Field Details

ACE_PREFIX

public static final String ACE_PREFIX

Method Details

toASCII

public static String toASCII(String input)
            throws IDNAException
Converts a Unicode string to ASCII using the procedure in RFC3490 section 4.1. Unassigned characters are not allowed and STD3 ASCII rules are enforced. The input string may be a domain name containing dots.

Parameters:
input - Unicode string.

Returns:
Encoded string.


toASCII

public static String toASCII(String input,
                             boolean allowUnassigned,
                             boolean useSTD3ASCIIRules)
            throws IDNAException
Converts a Unicode string to ASCII using the procedure in RFC3490 section 4.1. Unassigned characters are not allowed and STD3 ASCII rules are enforced.

Parameters:
input - Unicode string.
allowUnassigned - Unassigned characters, allowed or not?
useSTD3ASCIIRules - STD3 ASCII rules, enforced or not?

Returns:
Encoded string.


toUnicode

public static String toUnicode(String input)
Converts an ASCII-encoded string to Unicode. Unassigned characters are not allowed and STD3 hostnames are enforced. Input may be domain name containing dots.

Parameters:
input - ASCII input string.

Returns:
Unicode string.


toUnicode

public static String toUnicode(String input,
                               boolean allowUnassigned,
                               boolean useSTD3ASCIIRules)
Converts an ASCII-encoded string to Unicode.

Parameters:
input - ASCII input string.
allowUnassigned - Allow unassigned Unicode characters.
useSTD3ASCIIRules - Check that the output conforms to STD3.

Returns:
Unicode string.