$Id: idnconv.1,v 1.1 2003/06/04 00:27:10 marka Exp $ Copyright (c) 2000,2001,2002 Japan Network Information Center. All rights reserved. By using this file, you agree to the terms and conditions set forth bellow. LICENSE TERMS AND CONDITIONS The following License Terms and Conditions apply, unless a different license is obtained from Japan Network Information Center ("JPNIC"), a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda, Chiyoda-ku, Tokyo 101-0047, Japan. 1. Use, Modification and Redistribution (including distribution of any modified or derived work) in source and/or binary forms is permitted under this License Terms and Conditions. 2. Redistribution of source code must retain the copyright notices as they appear in each source code file, this License Terms and Conditions. 3. Redistribution in binary form must reproduce the Copyright Notice, this License Terms and Conditions, in the documentation and/or other materials provided with the distribution. For the purposes of binary distribution the "Copyright Notice" refers to the following language: "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved." 4. The name of JPNIC may not be used to endorse or promote products derived from this Software without specific prior written approval of JPNIC. 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IDNCONV 1 "Mar 3, 2001"
NAME
idnconv - codeset converter for
named.conf and zone master files
SYNOPSIS
idnconv [
options..] [
file...]
DESCRIPTION
idnconv is a codeset converter for named configuration files
and zone master files.
idnconv performs codeset conversion specified either
by the command-line arguments or by the configuration file,
and writes the converted text to stdout.
If file name is specified, idnconv converts the contents of
the file.
Otherwise, idnconv converts stdin.
Since idnconv is specifically designed for converting
internatinalized domain names, it may not be suitable as a general
codeset converter.
"OPERATION MODES"
idnconv has two operation modes.
One is a mode to convert local-encoded domain names to IDN-encoded
one. Usually this mode is used for preparing domain names to be
listed in named configuration files or zone master files.
In this mode, the following processes are performed in addition to
the codeset (encoding) conversion.
- 2
local mapping
- 2
standard domain name preperation (NAMEPREP)
The other mode is a reverse conversion, from IDN-encoded domain name to
local-encoded domain names.
In this mode, local mapping and NAMEPREP are not performed since
IDN-encoded names should already be normalized.
Instead, a check is done in order to make sure the IDN-encoded domain name
is properly NAMEPREP'ed. If it is not, the name will be output in
IDN encoding, not in the local encoding.
OPTIONS
Normally
idnconv reads system's default configuration file
(
idn.conf) and performs conversion or name preparation according to
the parameters specified in the file.
You can override the setting in the configuration file by various
command line options below.
4
-in in-code, -i in-code
Specify the codeset name of the input text.
Any of the following codeset names can be specified.
"\(bu" 2
Any codeset names which
iconv_open() library function accepts
"\(bu" 2
Punycode
"\(bu" 2
UTF-8
"\(bu" 2
Any alias names for the above, defined by the codeset alias file.
"" 4
If this option is not specified, the default codeset is determined
from the locale in normal conversion mode.
In reverse conversion mode, the default codeset is the IDN encoding
specified by the configuration file (``idn-encoding'' entry).
4
-out out-code, -o out-code
Specify the codeset name of the output text. out-code can be any
codeset name that can be specified for -in option.
"" 4
If this option is not specified, the default is the IDN encoding
specified by the configuration file (``idn-encoding'' entry) in
normal conversion mode.
In reverse conversion mode, the default codeset is determined from
the locale.
4
-conf path, -c path
Specify the pathname of idnkit configuration file (``idn.conf'').
If not specified, system's default file is used, unless -noconf
option is specified.
4
-noconf, -C
Specify that no configuration file is to be used.
4
-reverse, -r
Specify reverse conversion mode.
If this option is not specified, the normal conversion mode is used.
4
-nameprep version, -n version
Specify the version of NAMEPREP.
The following is a list of currently available versions.
RFC3491 4
Perform NAMEPREP according to the RFC3491
``
rfc-3491.txt''.
4
-nonameprep, -N
Specify to skip NAMEPREP process (or NAMEPREP verification process
in the reverse conversion mode).
This option implies -nounassigncheck and -nobidicheck.
4
-localmap map
Specify the name of local mapping rule.
Currently, following maps are available.
RFC3491 4
Use the list of mappings specified by RFC3491.
filemap:path 4
Use list of mappings specified by mapfile
path.
See
idn.conf(5) for the format of a mapfile.
"" 4
This option can be specified more than once.
In that case, each mapping will be performed in the order of the
specification.
4
-nounassigncheck, -U
Skip unassigned codepoint check.
4
-nobidicheck, -B
Skip bidi character check.
4
-nolengthcheck
Do not check label length of normal conversion result.
This option is only meaningful in the normal conversion mode.
4
-noasciicheck, -A
Do not check ASCII range characters.
This option is only meaningful in the normal conversion mode.
4
-noroundtripcheck
Do not perform round trip check.
This option is only meaningful in the reverse conversion mode.
4
-delimiter codepoint
Specify the character to be mapped to domain name delimiter (period).
This option can be specified more than once in order to specify multiple
characters.
This option is only meaningful in the normal conversion mode.
4
-whole, -w
Perform local mapping, nameprep and conversion to output codeset for the entire
input text. If this option is not specified, only non-ASCII characters
and their surrounding texts will be processed.
See ``NORAML CONVERSION MECHANISM'' and ``REVERSE CONVERSION MECHANISM''
for details.
4
-alias path, -a path
Specify a codeset alias file. It is a simple text file, where
each line has a pair of alias name and real name separated by one
or more white spaces like below:
alias-codeset-name real-codeset-name
Lines starting with ``#'' are treated as comments.
4
-flush
Force line-buffering mode.
4
-version, -v
Print version information and quit.
LOCAL CODESET
idnconv guesses local codeset from locale and environment variables.
See the ``LOCAL CODESET'' section in
idn.conf(5) for more details.
NORMAL CONVERSION MECHANISM
idnconv performs conversion line by line.
Here describes how
idnconv does its job for each line.
"1. read a line from input text" 4
"2. convert the line to UTF-8" 4
idnconv converts the line from local encoding to UTF-8.
"3. find internationalized domain names" 4
If the -whole (or -w) option is specified, the entire line is
assumed as an internationalized domain name.
Otherwise,
idnconv recognizes any character sequences having
the following properties in the line as internationalized domain names.
"\(bu" 2
containing at least one non-ASCII character, and
"\(bu" 2
consisting of legal domain name characters (alphabets, digits, hypens),
non-ASCII characters and period.
"4. convert internationalized domain names to ACE" 4
For each internationalized domain name found in the line,
idnconv converts the name to ACE.
The details about the conversion procedure is:
"4.1. delimiter mapping" 4
Substibute certain characters specified as domain name delimiter
with period.
"4.2. local mapping" 4
Perform local mapping.
If the local mapping is specified by command line option -localmap,
the specified mapping rule is applied. Otherwise, find the mapping rule
from the configuration file which matches to the TLD of the name,
and perform mapping according to the matched rule.
This step is skipped if the -nolocalmap (or -L) option is specified.
"4.3. NAMEPREP" 4
Perform name preparation (NAMEPREP).
Mapping, normalization, prohibited character checking, unassigned
codepoint checking, bidirectional character checking are done in
that order.
If the prohibited character check, unassigned codepoint check, or
bidi character check fails, the normal conversion procedure aborts.
This step is skipped if the -nonameprep (or -N) option is specified.
"4.4. ASCII character checking" 4
Checks ASCII range character in the domain name.
the normal conversion procedure aborts, if the domain name has a label
beginning or end with hyphen (U+002D) or it contains ASCII range character
except for alphanumeric and hyphen,
This step is skipped if the -noasciicheck (or -A) option is specified.
"4.5. ACE conversion" 4
Convert the string to ACE.
"4.6. label length checking" 4
The normal conversion procedure aborts, if the domain name has an empty
label or too long label (64 characters or more).
This step is skipped if the -nolengthcheck option is specified.
"5. output the result" 4
REVERSE CONVERSION MECHANISM
This is like the normal conversion mechanism, but they are not symmetric.
idnconv does its job for each line.
"1. read a line from input text" 4
"2. convert the line to UTF-8" 4
idnconv converts the line from local encoding to UTF-8.
"3. find internationalized domain names" 4
If the -whole (or -w) option is specified, the entire line is
assumed as an internationalized domain name.
Otherwise,
idnconv decodes any valid ASCII domain names
including ACE names in the line.
"4. convert domain names to local encoding"
Then,
idnconv decodes the domain names.
The decode procedure consists of the following steps.
"4.1. Delimiter mapping" 4
Substibute certain characters specified as domain name delimiter
with period.
"4.2. NAMEPREP" 4
Perform name preparation (NAMEPREP) for each label in the domain name.
Mapping, normalization, prohibited character checking, unassigned
codepoint checking, bidirectional character checking are done in
that order.
If the prohibited character check, unassigned codepoint check, or
bidi character check fails, disqualified labels are restored to
original input strings and further conversion on those labels are
not performed.
This step is skipped if the -nonameprep (or -N) option is specified.
"4.3. ACE conversion" 4
Convert the string from ACE to UTF-8.
"4.4. Round trip checkning" 4
For each label, perform the normal conversion and compare it with
the result of the step 4.2.
This check succeeds, if they are equivalent strings.
In case of failure, disqualified labels are restored to original
input strings and further conversion on those labels are not
performed.
This step is skipped if the -noroundtripcheck option is specified.
"4.5. local encoding conversion" 4
Convert the result of the step 4.3. from UTF-8 to local encoding.
If a label in the domain name contains a character which cannot be
represented in the local encoding, the label is restored to the
original input string.
"5. output the result" 4
FILE MANAGEMENT
Maybe the best way to manage
named.conf or zone master files that contains
internationalized domain name is to keep them in your local codeset so that
they can be edited with your favorite editor, and generate a version in
the IDN encoding using
idnconv.
`make' is a convenient tool for this purpose.
Suppose the local codeset version has suffix `.lc', and its ACE version
has suffix `.ace'. The following Makefile enables you to generate
ACE version from local codeset version by just typing `make'.
.SUFFIXES: .lc .ace
.lc.ace:
idnconv -in $(LOCALCODE) -out $(IDNCODE) \\
$(IDNCONVOPT) $< > $@
LOCALCODE = EUC-JP
IDNCODE = Punycode
IDNCONVOPT =
DESTFILES = db.zone1.ace db.zone2.ace
all: $(DESTFILES)
SEE ALSO
idn.conf(5),
iconv(3)
BUGS
The automatic input-code selection depends on your system, and sometimes
it cannot guess or guess wrong. It is better to explicitly specify it
using -in option.