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

📄 unicode::normalize.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 2 页
字号:
.SpFor example, when you have a \s-1NFD/NFKD\s0 string,you can get its \s-1NFC/NFKC\s0 string, by saying.Sp.Vb 2\&    $NFC_string  = compose($NFD_string);\&    $NFKC_string = compose($NFKD_string);.Ve.Sh "Quick Check".IX Subsection "Quick Check"(see Annex 8, \s-1UAX\s0 #15; and \fIDerivedNormalizationProps.txt\fR).PPThe following functions check whether the string is in that normalization form..PPThe result returned will be one of the following:.PP.Vb 3\&    YES     The string is in that normalization form.\&    NO      The string is not in that normalization form.\&    MAYBE   Dubious. Maybe yes, maybe no..Ve.ie n .IP """$result = checkNFD($string)""" 4.el .IP "\f(CW$result = checkNFD($string)\fR" 4.IX Item "$result = checkNFD($string)"It returns true (\f(CW1\fR) if \f(CW\*(C`YES\*(C'\fR; false (\f(CW\*(C`empty string\*(C'\fR) if \f(CW\*(C`NO\*(C'\fR..ie n .IP """$result = checkNFC($string)""" 4.el .IP "\f(CW$result = checkNFC($string)\fR" 4.IX Item "$result = checkNFC($string)"It returns true (\f(CW1\fR) if \f(CW\*(C`YES\*(C'\fR; false (\f(CW\*(C`empty string\*(C'\fR) if \f(CW\*(C`NO\*(C'\fR;\&\f(CW\*(C`undef\*(C'\fR if \f(CW\*(C`MAYBE\*(C'\fR..ie n .IP """$result = checkNFKD($string)""" 4.el .IP "\f(CW$result = checkNFKD($string)\fR" 4.IX Item "$result = checkNFKD($string)"It returns true (\f(CW1\fR) if \f(CW\*(C`YES\*(C'\fR; false (\f(CW\*(C`empty string\*(C'\fR) if \f(CW\*(C`NO\*(C'\fR..ie n .IP """$result = checkNFKC($string)""" 4.el .IP "\f(CW$result = checkNFKC($string)\fR" 4.IX Item "$result = checkNFKC($string)"It returns true (\f(CW1\fR) if \f(CW\*(C`YES\*(C'\fR; false (\f(CW\*(C`empty string\*(C'\fR) if \f(CW\*(C`NO\*(C'\fR;\&\f(CW\*(C`undef\*(C'\fR if \f(CW\*(C`MAYBE\*(C'\fR..ie n .IP """$result = checkFCD($string)""" 4.el .IP "\f(CW$result = checkFCD($string)\fR" 4.IX Item "$result = checkFCD($string)"It returns true (\f(CW1\fR) if \f(CW\*(C`YES\*(C'\fR; false (\f(CW\*(C`empty string\*(C'\fR) if \f(CW\*(C`NO\*(C'\fR..ie n .IP """$result = checkFCC($string)""" 4.el .IP "\f(CW$result = checkFCC($string)\fR" 4.IX Item "$result = checkFCC($string)"It returns true (\f(CW1\fR) if \f(CW\*(C`YES\*(C'\fR; false (\f(CW\*(C`empty string\*(C'\fR) if \f(CW\*(C`NO\*(C'\fR;\&\f(CW\*(C`undef\*(C'\fR if \f(CW\*(C`MAYBE\*(C'\fR..SpNote: If a string is not in \s-1FCD\s0, it must not be in \s-1FCC\s0.So \f(CW\*(C`checkFCC($not_FCD_string)\*(C'\fR should return \f(CW\*(C`NO\*(C'\fR..ie n .IP """$result = check($form_name, $string)""" 4.el .IP "\f(CW$result = check($form_name, $string)\fR" 4.IX Item "$result = check($form_name, $string)"It returns true (\f(CW1\fR) if \f(CW\*(C`YES\*(C'\fR; false (\f(CW\*(C`empty string\*(C'\fR) if \f(CW\*(C`NO\*(C'\fR;\&\f(CW\*(C`undef\*(C'\fR if \f(CW\*(C`MAYBE\*(C'\fR..SpAs \f(CW$form_name\fR, one of the following names must be given..Sp.Vb 4\&  \*(AqC\*(Aq  or \*(AqNFC\*(Aq  for Normalization Form C  (UAX #15)\&  \*(AqD\*(Aq  or \*(AqNFD\*(Aq  for Normalization Form D  (UAX #15)\&  \*(AqKC\*(Aq or \*(AqNFKC\*(Aq for Normalization Form KC (UAX #15)\&  \*(AqKD\*(Aq or \*(AqNFKD\*(Aq for Normalization Form KD (UAX #15)\&\&  \*(AqFCD\*(Aq          for "Fast C or D" Form  (UTN #5)\&  \*(AqFCC\*(Aq          for "Fast C Contiguous" (UTN #5).Ve.PP\&\fBNote\fR.PPIn the cases of \s-1NFD\s0, \s-1NFKD\s0, and \s-1FCD\s0, the answer must beeither \f(CW\*(C`YES\*(C'\fR or \f(CW\*(C`NO\*(C'\fR. The answer \f(CW\*(C`MAYBE\*(C'\fR may be returnedin the cases of \s-1NFC\s0, \s-1NFKC\s0, and \s-1FCC\s0..PPA \f(CW\*(C`MAYBE\*(C'\fR string should contain at least one combining characteror the like. For example, \f(CW\*(C`COMBINING ACUTE ACCENT\*(C'\fR hasthe \s-1MAYBE_NFC/MAYBE_NFKC\s0 property..PPBoth \f(CW\*(C`checkNFC("A\eN{COMBINING ACUTE ACCENT}")\*(C'\fRand \f(CW\*(C`checkNFC("B\eN{COMBINING ACUTE ACCENT}")\*(C'\fR will return \f(CW\*(C`MAYBE\*(C'\fR.\&\f(CW"A\eN{COMBINING ACUTE ACCENT}"\fR is not in \s-1NFC\s0(its \s-1NFC\s0 is \f(CW"\eN{LATIN CAPITAL LETTER A WITH ACUTE}"\fR),while \f(CW"B\eN{COMBINING ACUTE ACCENT}"\fR is in \s-1NFC\s0..PPIf you want to check exactly, compare the string with its \s-1NFC/NFKC/FCC\s0..PP.Vb 5\&    if ($string eq NFC($string)) {\&        # $string is exactly normalized in NFC;\&    } else {\&        # $string is not normalized in NFC;\&    }\&\&    if ($string eq NFKC($string)) {\&        # $string is exactly normalized in NFKC;\&    } else {\&        # $string is not normalized in NFKC;\&    }.Ve.Sh "Character Data".IX Subsection "Character Data"These functions are interface of character data used internally.If you want only to get Unicode normalization forms, you don't needcall them yourself..ie n .IP """$canonical_decomposition = getCanon($code_point)""" 4.el .IP "\f(CW$canonical_decomposition = getCanon($code_point)\fR" 4.IX Item "$canonical_decomposition = getCanon($code_point)"If the character is canonically decomposable (including Hangul Syllables),it returns the (full) canonical decomposition as a string.Otherwise it returns \f(CW\*(C`undef\*(C'\fR..Sp\&\fBNote:\fR According to the Unicode standard, the canonical decompositionof the character that is not canonically decomposable is same asthe character itself..ie n .IP """$compatibility_decomposition = getCompat($code_point)""" 4.el .IP "\f(CW$compatibility_decomposition = getCompat($code_point)\fR" 4.IX Item "$compatibility_decomposition = getCompat($code_point)"If the character is compatibility decomposable (including Hangul Syllables),it returns the (full) compatibility decomposition as a string.Otherwise it returns \f(CW\*(C`undef\*(C'\fR..Sp\&\fBNote:\fR According to the Unicode standard, the compatibility decompositionof the character that is not compatibility decomposable is same asthe character itself..ie n .IP """$code_point_composite = getComposite($code_point_here, $code_point_next)""" 4.el .IP "\f(CW$code_point_composite = getComposite($code_point_here, $code_point_next)\fR" 4.IX Item "$code_point_composite = getComposite($code_point_here, $code_point_next)"If two characters here and next (as code points) are composable(including Hangul Jamo/Syllables and Composition Exclusions),it returns the code point of the composite..SpIf they are not composable, it returns \f(CW\*(C`undef\*(C'\fR..ie n .IP """$combining_class = getCombinClass($code_point)""" 4.el .IP "\f(CW$combining_class = getCombinClass($code_point)\fR" 4.IX Item "$combining_class = getCombinClass($code_point)"It returns the combining class (as an integer) of the character..ie n .IP """$may_be_composed_with_prev_char = isComp2nd($code_point)""" 4.el .IP "\f(CW$may_be_composed_with_prev_char = isComp2nd($code_point)\fR" 4.IX Item "$may_be_composed_with_prev_char = isComp2nd($code_point)"It returns a boolean whether the character of the specified codepointmay be composed with the previous one in a certain composition(including Hangul Compositions, but excludingComposition Exclusions and Non-Starter Decompositions)..ie n .IP """$is_exclusion = isExclusion($code_point)""" 4.el .IP "\f(CW$is_exclusion = isExclusion($code_point)\fR" 4.IX Item "$is_exclusion = isExclusion($code_point)"It returns a boolean whether the code point is a composition exclusion..ie n .IP """$is_singleton = isSingleton($code_point)""" 4.el .IP "\f(CW$is_singleton = isSingleton($code_point)\fR" 4.IX Item "$is_singleton = isSingleton($code_point)"It returns a boolean whether the code point is a singleton.ie n .IP """$is_non_starter_decomposition = isNonStDecomp($code_point)""" 4.el .IP "\f(CW$is_non_starter_decomposition = isNonStDecomp($code_point)\fR" 4.IX Item "$is_non_starter_decomposition = isNonStDecomp($code_point)"It returns a boolean whether the code point has Non-Starter Decomposition..ie n .IP """$is_Full_Composition_Exclusion = isComp_Ex($code_point)""" 4.el .IP "\f(CW$is_Full_Composition_Exclusion = isComp_Ex($code_point)\fR" 4.IX Item "$is_Full_Composition_Exclusion = isComp_Ex($code_point)"It returns a boolean of the derived property Comp_Ex(Full_Composition_Exclusion). This property is generated fromComposition Exclusions + Singletons + Non-Starter Decompositions..ie n .IP """$NFD_is_NO = isNFD_NO($code_point)""" 4.el .IP "\f(CW$NFD_is_NO = isNFD_NO($code_point)\fR" 4.IX Item "$NFD_is_NO = isNFD_NO($code_point)"It returns a boolean of the derived property \s-1NFD_NO\s0(NFD_Quick_Check=No)..ie n .IP """$NFC_is_NO = isNFC_NO($code_point)""" 4.el .IP "\f(CW$NFC_is_NO = isNFC_NO($code_point)\fR" 4.IX Item "$NFC_is_NO = isNFC_NO($code_point)"It returns a boolean of the derived property \s-1NFC_NO\s0(NFC_Quick_Check=No)..ie n .IP """$NFC_is_MAYBE = isNFC_MAYBE($code_point)""" 4.el .IP "\f(CW$NFC_is_MAYBE = isNFC_MAYBE($code_point)\fR" 4.IX Item "$NFC_is_MAYBE = isNFC_MAYBE($code_point)"It returns a boolean of the derived property \s-1NFC_MAYBE\s0(NFC_Quick_Check=Maybe)..ie n .IP """$NFKD_is_NO = isNFKD_NO($code_point)""" 4.el .IP "\f(CW$NFKD_is_NO = isNFKD_NO($code_point)\fR" 4.IX Item "$NFKD_is_NO = isNFKD_NO($code_point)"It returns a boolean of the derived property \s-1NFKD_NO\s0(NFKD_Quick_Check=No)..ie n .IP """$NFKC_is_NO = isNFKC_NO($code_point)""" 4.el .IP "\f(CW$NFKC_is_NO = isNFKC_NO($code_point)\fR" 4.IX Item "$NFKC_is_NO = isNFKC_NO($code_point)"It returns a boolean of the derived property \s-1NFKC_NO\s0(NFKC_Quick_Check=No)..ie n .IP """$NFKC_is_MAYBE = isNFKC_MAYBE($code_point)""" 4.el .IP "\f(CW$NFKC_is_MAYBE = isNFKC_MAYBE($code_point)\fR" 4.IX Item "$NFKC_is_MAYBE = isNFKC_MAYBE($code_point)"It returns a boolean of the derived property \s-1NFKC_MAYBE\s0(NFKC_Quick_Check=Maybe)..SH "EXPORT".IX Header "EXPORT"\&\f(CW\*(C`NFC\*(C'\fR, \f(CW\*(C`NFD\*(C'\fR, \f(CW\*(C`NFKC\*(C'\fR, \f(CW\*(C`NFKD\*(C'\fR: by default..PP\&\f(CW\*(C`normalize\*(C'\fR and other some functions: on request..SH "CAVEATS".IX Header "CAVEATS".IP "Perl's version vs. Unicode version" 4.IX Item "Perl's version vs. Unicode version"Since this module refers to perl core's Unicode database in the directory\&\fI/lib/unicore\fR (or formerly \fI/lib/unicode\fR), the Unicode version ofnormalization implemented by this module depends on your perl's version..Sp.Vb 8\&    perl\*(Aqs version     implemented Unicode version\&       5.6.1              3.0.1\&       5.7.2              3.1.0\&       5.7.3              3.1.1 (normalization is same as 3.1.0)\&       5.8.0              3.2.0\&     5.8.1\-5.8.3          4.0.0\&     5.8.4\-5.8.6          4.0.1 (normalization is same as 4.0.0)\&     5.8.7\-5.8.8          4.1.0.Ve.IP "Correction of decomposition mapping" 4.IX Item "Correction of decomposition mapping"In older Unicode versions, a small number of characters (all of which are\&\s-1CJK\s0 compatibility ideographs as far as they have been found) may havean erroneous decomposition mapping (see \fINormalizationCorrections.txt\fR).Anyhow, this module will neither refer to \fINormalizationCorrections.txt\fRnor provide any specific version of normalization. Therefore this modulerunning on an older perl with an older Unicode database may usethe erroneous decomposition mapping blindly conforming to the Unicode database..IP "Revised definition of canonical composition" 4.IX Item "Revised definition of canonical composition"In Unicode 4.1.0, the definition D2 of canonical composition (whichaffects \s-1NFC\s0 and \s-1NFKC\s0) has been changed (see Public Review Issue #29and recent \s-1UAX\s0 #15). This module has used the newer definitionsince the version 0.07 (Oct 31, 2001).This module will not support the normalization according to the olderdefinition, even if the Unicode version implemented by perl islower than 4.1.0..SH "AUTHOR".IX Header "AUTHOR"\&\s-1SADAHIRO\s0 Tomoyuki <SADAHIRO@cpan.org>.PPCopyright(C) 2001\-2007, \s-1SADAHIRO\s0 Tomoyuki. Japan. All rights reserved..PPThis module is free software; you can redistribute itand/or modify it under the same terms as Perl itself..SH "SEE ALSO".IX Header "SEE ALSO".IP "http://www.unicode.org/reports/tr15/" 4.IX Item "http://www.unicode.org/reports/tr15/"Unicode Normalization Forms \- \s-1UAX\s0 #15.IP "http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt" 4.IX Item "http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt"Composition Exclusion Table.IP "http://www.unicode.org/Public/UNIDATA/DerivedNormalizationProps.txt" 4.IX Item "http://www.unicode.org/Public/UNIDATA/DerivedNormalizationProps.txt"Derived Normalization Properties.IP "http://www.unicode.org/Public/UNIDATA/NormalizationCorrections.txt" 4.IX Item "http://www.unicode.org/Public/UNIDATA/NormalizationCorrections.txt"Normalization Corrections.IP "http://www.unicode.org/review/pr\-29.html" 4.IX Item "http://www.unicode.org/review/pr-29.html"Public Review Issue #29: Normalization Issue.IP "http://www.unicode.org/notes/tn5/" 4.IX Item "http://www.unicode.org/notes/tn5/"Canonical Equivalence in Applications \- \s-1UTN\s0 #5

⌨️ 快捷键说明

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