📄 idnconv.1
字号:
.\" $Id: idnconv.1,v 1.1.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..\".TH IDNCONV 1 "Mar 3, 2001".\".SH NAMEidnconv \- codeset converter for named.conf and zone master files.\".SH SYNOPSIS\fBidnconv\fP [\fIoptions..\fP] [\fIfile\fP...].\".SH DESCRIPTION\fBidnconv\fR is a codeset converter for named configuration filesand zone master files.\fBidnconv\fR performs codeset conversion specified eitherby the command-line arguments or by the configuration file,and writes the converted text to stdout..PPIf file name is specified, \fBidnconv\fR converts the contents ofthe file.Otherwise, \fBidnconv\fR converts \fIstdin\fR..PPSince \fBidnconv\fR is specifically designed for convertinginternatinalized domain names, it may not be suitable as a generalcodeset converter..\".SH "OPERATION MODES"\fBidnconv\fR has two operation modes..PPOne is a mode to convert local-encoded domain names to IDN-encodedone. Usually this mode is used for preparing domain names to belisted in named configuration files or zone master files.In this mode, the following processes are performed in addition tothe codeset (encoding) conversion..RS 2.IP \- 2local mapping.IP \- 2standard domain name preperation (NAMEPREP).RE.PPThe other mode is a reverse conversion, from IDN-encoded domain name tolocal-encoded domain names.In this mode, local mapping and NAMEPREP are not performed sinceIDN-encoded names should already be normalized.Instead, a check is done in order to make sure the IDN-encoded domain nameis properly NAMEPREP'ed. If it is not, the name will be output inIDN encoding, not in the local encoding..\".SH OPTIONSNormally \fBidnconv\fR reads system's default configuration file(idn.conf) and performs conversion or name preparation according tothe parameters specified in the file.You can override the setting in the configuration file by variouscommand line options below..TP 4\fB\-in\fP \fIin-code\fP, \fB\-i\fP \fIin-code\fPSpecify the codeset name of the input text.Any of the following codeset names can be specified..RS 4.IP "\(bu" 2Any codeset names which \fIiconv_open()\fP library function accepts.IP "\(bu" 2\f(CWPunycode\fR.IP "\(bu" 2\f(CWUTF-8\fR.IP "\(bu" 2Any alias names for the above, defined by the codeset alias file..RE.IP "" 4If this option is not specified, the default codeset is determinedfrom the locale in normal conversion mode.In reverse conversion mode, the default codeset is the IDN encodingspecified by the configuration file (``idn-encoding'' entry)..TP 4\fB\-out\fP \fIout-code\fP, \fB\-o\fP \fIout-code\fPSpecify the codeset name of the output text. \fIout-code\fP can be anycodeset name that can be specified for \fB\-in\fR option..IP "" 4If this option is not specified, the default is the IDN encodingspecified by the configuration file (``idn-encoding'' entry) innormal conversion mode.In reverse conversion mode, the default codeset is determined fromthe locale..TP 4\fB\-conf\fP \fIpath\fP, \fB\-c\fP \fIpath\fPSpecify the pathname of idnkit configuration file (``idn.conf'').If not specified, system's default file is used, unless \-noconfoption is specified..TP 4\fB\-noconf\fP, \fB\-C\fPSpecify that no configuration file is to be used..TP 4\fB\-reverse\fP, \fB\-r\fPSpecify reverse conversion mode..brIf this option is not specified, the normal conversion mode is used..TP 4\fB\-nameprep\fR \fIversion\fR, \fB\-n\fR \fIversion\fRSpecify the version of NAMEPREP.The following is a list of currently available versions..RS 4.IP \f(CWRFC3491\fR 4Perform NAMEPREP according to the RFC3491``rfc-3491.txt''..RE.TP 4\fB\-nonameprep\fR, \fB\-N\fRSpecify to skip NAMEPREP process (or NAMEPREP verification processin the reverse conversion mode).This option implies -nounassigncheck and -nobidicheck..TP 4\fB\-localmap\fR \fImap\fRSpecify the name of local mapping rule.Currently, following maps are available..RS 4.IP \f(CWRFC3491\fR 4Use the list of mappings specified by RFC3491..IP \f(CWfilemap:\fR\fIpath\fR 4Use list of mappings specified by mapfile \fIpath\fR.See idn.conf(5) for the format of a mapfile..RE.IP "" 4This option can be specified more than once.In that case, each mapping will be performed in the order of thespecification..TP 4\fB\-nounassigncheck\fR, \fB\-U\fRSkip unassigned codepoint check..TP 4\fB\-nobidicheck\fR, \fB\-B\fRSkip bidi character check..TP 4\fB\-nolengthcheck\fRDo not check label length of normal conversion result.This option is only meaningful in the normal conversion mode..TP 4\fB\-noasciicheck\fR, \fB\-A\fRDo not check ASCII range characters.This option is only meaningful in the normal conversion mode..TP 4\fB\-noroundtripcheck\fRDo not perform round trip check.This option is only meaningful in the reverse conversion mode..TP 4\fB\-delimiter\fR \fIcodepoint\fPSpecify the character to be mapped to domain name delimiter (period).This option can be specified more than once in order to specify multiplecharacters..brThis option is only meaningful in the normal conversion mode..TP 4\fB\-whole\fP, \fB\-w\fPPerform local mapping, nameprep and conversion to output codeset for the entireinput text. If this option is not specified, only non-ASCII charactersand their surrounding texts will be processed.See ``NORAML CONVERSION MECHANISM'' and ``REVERSE CONVERSION MECHANISM''for details..TP 4\fB\-alias\fP \fIpath\fP, \fB\-a\fP \fIpath\fPSpecify a codeset alias file. It is a simple text file, whereeach line has a pair of alias name and real name separated by oneor more white spaces like below:.nf.ft CW \fIalias-codeset-name\fP \fIreal-codeset-name\fP.ft R.fiLines starting with ``#'' are treated as comments..TP 4\fB\-flush\fPForce line-buffering mode..TP 4\fB\-version\fP, \fB\-v\fPPrint version information and quit..\".SH LOCAL CODESETidnconv guesses local codeset from locale and environment variables.See the ``LOCAL CODESET'' section in idn.conf(5) for more details..\".SH NORMAL CONVERSION MECHANISM\fBidnconv\fR performs conversion line by line.Here describes how \fBidnconv\fR does its job for each line..\".IP "1. read a line from input text" 4.IP "2. convert the line to UTF-8" 4\fBidnconv\fR converts the line from local encoding to UTF-8..IP "3. find internationalized domain names" 4If the \-whole\ (or \-w) option is specified, the entire line isassumed as an internationalized domain name.Otherwise, \fBidnconv\fR recognizes any character sequences havingthe following properties in the line as internationalized domain names..RS 4.IP "\(bu" 2containing at least one non-ASCII character, and.IP "\(bu" 2consisting of legal domain name characters (alphabets, digits, hypens),non-ASCII characters and period..RE.IP "4. convert internationalized domain names to ACE" 4For each internationalized domain name found in the line,\fBidnconv\fR converts the name to ACE.The details about the conversion procedure is:.RS 4.IP "4.1. delimiter mapping" 4Substibute certain characters specified as domain name delimiterwith period..IP "4.2. local mapping" 4Perform local mapping.If the local mapping is specified by command line option \-localmap,the specified mapping rule is applied. Otherwise, find the mapping rulefrom the configuration file which matches to the TLD of the name,and perform mapping according to the matched rule..brThis step is skipped if the \-nolocalmap (or \-L) option is specified..IP "4.3. NAMEPREP" 4Perform name preparation (NAMEPREP).Mapping, normalization, prohibited character checking, unassignedcodepoint checking, bidirectional character checking are done inthat order.If the prohibited character check, unassigned codepoint check, orbidi character check fails, the normal conversion procedure aborts..brThis step is skipped if the \-nonameprep (or \-N) option is specified..IP "4.4. ASCII character checking" 4Checks ASCII range character in the domain name.the normal conversion procedure aborts, if the domain name has a labelbeginning or end with hyphen (U+002D) or it contains ASCII range characterexcept for alphanumeric and hyphen,.brThis step is skipped if the \-noasciicheck (or \-A) option is specified..IP "4.5. ACE conversion" 4Convert the string to ACE..IP "4.6. label length checking" 4The normal conversion procedure aborts, if the domain name has an emptylabel or too long label (64 characters or more)..brThis step is skipped if the \-nolengthcheck option is specified..RE.IP "5. output the result" 4.PP.\".SH REVERSE CONVERSION MECHANISMThis is like the normal conversion mechanism, but they are not symmetric.\fBidnconv\fR does its job for each line..\".IP "1. read a line from input text" 4.IP "2. convert the line to UTF-8" 4\fBidnconv\fR converts the line from local encoding to UTF-8..IP "3. find internationalized domain names" 4If the \-whole\ (or \-w) option is specified, the entire line isassumed as an internationalized domain name.Otherwise, \fBidnconv\fR decodes any valid ASCII domain namesincluding ACE names in the line..IP "4. convert domain names to local encoding"Then, \fBidnconv\fR decodes the domain names.The decode procedure consists of the following steps..RS 4.IP "4.1. Delimiter mapping" 4Substibute certain characters specified as domain name delimiterwith period..br.IP "4.2. NAMEPREP" 4Perform name preparation (NAMEPREP) for each label in the domain name.Mapping, normalization, prohibited character checking, unassignedcodepoint checking, bidirectional character checking are done inthat order.If the prohibited character check, unassigned codepoint check, orbidi character check fails, disqualified labels are restored tooriginal input strings and further conversion on those labels arenot performed..brThis step is skipped if the \-nonameprep (or \-N) option is specified..IP "4.3. ACE conversion" 4Convert the string from ACE to UTF-8..IP "4.4. Round trip checkning" 4For each label, perform the normal conversion and compare it withthe result of the step 4.2.This check succeeds, if they are equivalent strings.In case of failure, disqualified labels are restored to originalinput strings and further conversion on those labels are notperformed..brThis step is skipped if the \-noroundtripcheck option is specified..IP "4.5. local encoding conversion" 4Convert 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 berepresented in the local encoding, the label is restored to theoriginal input string..RE.IP "5. output the result" 4.PP.\".SH FILE MANAGEMENTMaybe the best way to manage named.conf or zone master files that containsinternationalized domain name is to keep them in your local codeset so thatthey can be edited with your favorite editor, and generate a version inthe IDN encoding using \fBidnconv\fP..PP`make' is a convenient tool for this purpose.Suppose the local codeset version has suffix `.lc', and its ACE versionhas suffix `.ace'. The following Makefile enables you to generateACE version from local codeset version by just typing `make'..RS 4.nf.ft CW\&.SUFFIXES: .lc .ace\&.lc.ace: idnconv -in $(LOCALCODE) -out $(IDNCODE) \\ $(IDNCONVOPT) $< > $@LOCALCODE = EUC-JPIDNCODE = PunycodeIDNCONVOPT = DESTFILES = db.zone1.ace db.zone2.aceall: $(DESTFILES).ft.fi.RE.\".SH SEE ALSOidn.conf(5),iconv(3).\".SH BUGSThe automatic input-code selection depends on your system, and sometimesit cannot guess or guess wrong. It is better to explicitly specify itusing \-in option.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -