⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libidnkit.3.in

📁 bind-3.2.
💻 IN
📖 第 1 页 / 共 2 页
字号:
.PP\fBidn_decodename2\fR function provides the same functionality as\fBidn_decodename\fR except that character encoding of \fIfrom\fR issupposed to be \fIauxencoding\fR.If IDN encoding is Punycode and \fIauxencoding\fR is ISO 8859-2for example, it is assumed that the Punycode string stored in\fIfrom\fR is written in ISO 8859-2..PPIn the IDN decode procedure, \fBIDN_NAMEPREP\fR is done before\fBIDN_IDNCONV\fR, and some non-ASCII characters are converted toASCII characters as the result of \fBIDN_NAMEPREP\fR.Therefore, ACE string given by \fBfrom\fR may contains those non-ASCIIcharacters.That is the reason \fBdocode_name2\fR exists..PPAll of the functions above return error code of type \fBidn_result_t\fR.All codes other than \fBidn_success\fR indicates some kind of failure.\fBidn_result_tostring\fR function takes an error code \fIresult\fRand returns a pointer to the corresponding message string..\".SH "NAME ENCODING"Name encoding is a process that transforms the specifiedinternationalized domain name to a certain string suitable for nameresolution.For each label in a given domain name, the encoding processor performs:.\".IP "(1) Convert to UTF-8 (IDN_LOCALCONV)"Convert the encoding of the given domain name from application's localencoding (e.g. ISO-8859-1) to UTF-8.Note that \fBlibidnkitlite\fR doesn't support this step..\".IP "(2) Delimiter mapping (IDN_DELIMMAP)"Map domain name delimiters to `.' (U+002E).The recoginzed delimiters are: U+3002 (ideographic full stop),U+FF0E (fullwidth full stop), U+FF61 (halfwidth ideographic full stop)..\".IP "(3) Local mapping (IDN_LOCALMAP)"Apply character mapping whose rule is determined by the TLD of the name..\".IP "(4) NAMEPREP (IDN_NAMEPREP, IDN_UNASCHECK)"Perform name preparation (NAMEPREP), which is a standard process forname canonicalizaion of internationalized domain names..brNAMEPREP consists of 5 steps:mapping, normalization, prohibited character check, bidirectionaltext check and unassigned codepoint check.The first four steps are done by IDN_NAMEPREP, and the last step isdone by IDN_UNASCHECK..\".IP "(5) ASCII range character check (IDN_ASCCHECK)"Checks if the domain name contains non-LDH ASCII character (notalpha-numeric or hyphen), or it begins or end with hyphen..\".IP "(6) Convert to ACE (IDN_IDNCONV)"Convert the NAMEPREPed name to a special encoding designed for representinginternationalized domain names..brThe encoding is also known as ACE (ASCII Compatible Encoding) sincea string in the encoding is just like a traditional ASCII domain nameconsisting of only letters, numbers and hyphens..\".IP "(7) Label length check (IDN_LENCHECK)"For each label, check the number of characters in it.It must be in the range 1 to 63..PPThere are many configuration parameters for this process, such as theACE or the local mapping rules.  These parameters are read from thedefault idnkit's configuration file, \fBidn.conf\fR.See idn.conf(5) for details..\".SH "NAME DECODING"Name decoding is a reverse process of the name encoding.It transforms the specifiedinternationalized domain name in a special encoding suitable for nameresolution to the normal name string in the application's current codeset.However, name encoding and name decoding are not symmetric..PPFor each label in a given domain name, the decoding processor performs:.\".IP "(1) Delimiter mapping (IDN_DELIMMAP)"Map domain name delimiters to `.' (U+002E).The recoginzed delimiters are: U+3002 (ideographic full stop),U+FF0E (fullwidth full stop), U+FF61 (halfwidth ideographic full stop)..\".IP "(2) NAMEPREP (IDN_NAMEPREP, IDN_UNASCHECK)"Perform name preparation (NAMEPREP), which is a standard process forname canonicalizaion of internationalized domain names..\".IP "(3) Convert to UTF-8 (IDN_IDNCONV)"Convert the encoding of the given domain name from ACE to UTF-8..\".IP "(4) Round trip check (IDN_RTCHECK)"Encode the result of (3) using the ``NAME ENCODING'' scheme, and thencompare it with the result of the step (2).If they are different, the check is failed.If IDN_UNASCHECK, IDN_ASCCHECK or both are specified, also they aredone in the encoding processes..\".IP "(5) Convert to local encoding"Convert the result of (3) from UTF-8 to the application's localencoding (e.g. ISO-8859-1).Note that \fBlibidnkitlite\fR doesn't support this step..PPIf prohibited character check, unassigned codepoint check or bidirectional text check at step (2) is failed, or round trip checkat step (4) is failed, the original input label is returned..PPThe configuration parameters for this process,are also read from the configuration file \fBidn.conf\fR..\".SH "IDN_DISABLE"If the \fBIDN_DISABLE\fR environ variable is defined at run-time,the libraries disable internationalized domain name support, by default.In this case, \fBidn_encodename\fR and \fBidn_decodename\fR don'tencode/decode an input name, but instead they simply ouput a copyof the input name as the result of encoding/decoding..PPIf your application should always enable mulitilingual domain namesupport regardless of definition of \fBIDN_DISABLE\fR, call.RS 4.nf.ft CWidn_enable(1).ft R.fi.RE.PPbefore performing encoding/decoding. .\".SH "RETURN VALUES"Most of the API functions return values of type \fBidn_result_t\fR inorder to indicate the status of the call.The following is a complete list of the status codes.  Note that someof them are never returned by the functions described in this manual..TP 15.SB idn_successNot an error.  The call succeeded..TP.SB idn_notfoundSpecified information does not exist..TP.SB idn_invalid_encodingThe encoding of the specified string is invalid..TP.SB idn_invalid_syntaxThere is a syntax error in the configuration file..TP.SB idn_invalid_nameThe specified name is not valid..TP.SB idn_invalid_messageThe specified DNS message is not valid..TP.SB idn_invalid_actionThe specified action contains invalid flags..TP.SB idn_invalid_codepointThe specified Unicode code point value is not valid..TP.SB idn_invalid_lengthThe number of characters in an ACE label is not in the range 1 to 63..TP.SB idn_buffer_overflowThe specified buffer is too small to hold the result..TP.SB idn_noentryThe specified key does not exist in the hash table..TP.SB idn_nomemoryMemory allocation using malloc failed..TP.SB idn_nofileThe specified file could not be opened..TP.SB idn_nomappingSome characters do not have the mapping to the target character set..TP.SB idn_context_requiredContext information is required..TP.SB idn_prohibitedThe specified string contains some prohibited characters..TP.SB idn_failureGeneric error which is not covered by the above codes..\".SH EXAMPLESTo get the address of a internationalized domain name in the application'slocal codeset, use \fBidn_encodename\fR to convert the name to the formatsuitable for passing to resolver functions..RS 4.nf.ft CWidn_result_t r;char ace_name[256];struct hostent *hp;\&...r = idn_encodename(IDN_ENCODE_APP, name, ace_name,                   sizeof(ace_name));if (r != idn_success) {    fprintf(stderr, "idn_encodename failed: %s\en",            idn_result_tostring(r));    exit(1);}hp = gethostbyname(ace_name);\&....ft R.fi.RE.PPTo decode the internationalized domain name returned from a resolver function,use \fBidn_decodename\fR..RS 4.nf.ft CWidn_result_t r;char local_name[256];struct hostent *hp;\&...hp = gethostbyname(name);r = idn_decodename(IDN_DECODE_APP, hp->h_name, local_name,                   sizeof(local_name));if (r != idn_success) {    fprintf(stderr, "idn_decodename failed: %s\en",            idn_result_tostring(r));    exit(1);}printf("name: %s\en", local_name);\&....ft R.fi.RE.\".SH "SEE ALSO"idn.conf(5)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -