stringprep-0.1.5/.cargo_vcs_info.json0000644000000001360000000000100132340ustar { "git": { "sha1": "97e2588933017b48122e8bb574efebb7410fa71c" }, "path_in_vcs": "" }stringprep-0.1.5/.github/workflows/ci.yml000064400000000000000000000043031046102023000165370ustar 00000000000000name: CI on: pull_request: branches: - master push: branches: - master env: RUSTFLAGS: -Dwarnings RUST_BACKTRACE: 1 jobs: rustfmt: name: rustfmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: sfackler/actions/rustup@master - uses: sfackler/actions/rustfmt@master clippy: name: clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: sfackler/actions/rustup@master - run: echo "version=$(rustc --version)" >> $GITHUB_OUTPUT id: rust-version - uses: actions/cache@v3 with: path: ~/.cargo/registry/index key: index-${{ runner.os }}-${{ github.run_number }} restore-keys: | index-${{ runner.os }}- - run: cargo generate-lockfile - uses: actions/cache@v3 with: path: ~/.cargo/registry/cache key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} - run: cargo fetch - uses: actions/cache@v3 with: path: target key: clippy-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y - run: cargo clippy --all --all-targets test: name: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: sfackler/actions/rustup@master with: version: 1.56.0 - run: echo "version=$(rustc --version)" >> $GITHUB_OUTPUT id: rust-version - uses: actions/cache@v3 with: path: ~/.cargo/registry/index key: index-${{ runner.os }}-${{ github.run_number }} restore-keys: | index-${{ runner.os }}- - run: cargo generate-lockfile - uses: actions/cache@v3 with: path: ~/.cargo/registry/cache key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} - run: cargo fetch - uses: actions/cache@v3 with: path: target key: test-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y - run: cargo test --all stringprep-0.1.5/.gitignore000064400000000000000000000000361046102023000140130ustar 00000000000000target/ **/*.rs.bk Cargo.lock stringprep-0.1.5/Cargo.toml0000644000000015660000000000100112420ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] name = "stringprep" version = "0.1.5" authors = ["Steven Fackler "] description = "An implementation of the stringprep algorithm" readme = "README.md" license = "MIT/Apache-2.0" repository = "https://github.com/sfackler/rust-stringprep" [dependencies.unicode-bidi] version = "0.3" [dependencies.unicode-normalization] version = "0.1" [dependencies.unicode-properties] version = "0.1.1" stringprep-0.1.5/Cargo.toml.orig000064400000000000000000000005531046102023000147160ustar 00000000000000[package] name = "stringprep" version = "0.1.5" authors = ["Steven Fackler "] license = "MIT/Apache-2.0" description = "An implementation of the stringprep algorithm" repository = "https://github.com/sfackler/rust-stringprep" readme = "README.md" [dependencies] unicode-bidi = "0.3" unicode-normalization = "0.1" unicode-properties = "0.1.1" stringprep-0.1.5/LICENSE-APACHE000064400000000000000000000261361046102023000137600ustar 00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. stringprep-0.1.5/LICENSE-MIT000064400000000000000000000020621046102023000134600ustar 00000000000000Copyright (c) 2017 The rust-stringprep Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. stringprep-0.1.5/README.md000064400000000000000000000012511046102023000133020ustar 00000000000000# stringprep [Documentation](https://docs.rs/stringprep) An implementation of the stringprep algorithm as defined in [RFC 3454][]. [RFC 3454]: https://tools.ietf.org/html/rfc3454 ## License Licensed under either of * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) at your option. ### Contribution Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. stringprep-0.1.5/src/lib.rs000064400000000000000000000344221046102023000137340ustar 00000000000000//! An implementation of the "stringprep" algorithm defined in [RFC 3454][]. //! //! [RFC 3454]: https://tools.ietf.org/html/rfc3454 #![warn(missing_docs)] extern crate unicode_bidi; extern crate unicode_normalization; extern crate unicode_properties; use std::borrow::Cow; use std::fmt; use unicode_normalization::UnicodeNormalization; use unicode_properties::{GeneralCategoryGroup, UnicodeGeneralCategory}; mod rfc3454; pub mod tables; /// Describes why a string failed stringprep normalization. #[derive(Debug)] enum ErrorCause { /// Contains stringprep prohibited characters. ProhibitedCharacter(char), /// Violates stringprep rules for bidirectional text. ProhibitedBidirectionalText, /// Starts with a combining character StartsWithCombiningCharacter, /// Empty String EmptyString, } /// An error performing the stringprep algorithm. #[derive(Debug)] pub struct Error(ErrorCause); impl fmt::Display for Error { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { match self.0 { ErrorCause::ProhibitedCharacter(c) => write!(fmt, "prohibited character `{}`", c), ErrorCause::ProhibitedBidirectionalText => write!(fmt, "prohibited bidirectional text"), ErrorCause::StartsWithCombiningCharacter => { write!(fmt, "starts with combining character") } ErrorCause::EmptyString => write!(fmt, "empty string"), } } } impl std::error::Error for Error {} /// Prepares a string with the SASLprep profile of the stringprep algorithm. /// /// SASLprep is defined in [RFC 4013][]. /// /// [RFC 4013]: https://tools.ietf.org/html/rfc4013 pub fn saslprep(s: &str) -> Result, Error> { // fast path for ascii text if s.chars() .all(|c| c.is_ascii() && !tables::ascii_control_character(c)) { return Ok(Cow::Borrowed(s)); } // 2.1 Mapping let mapped = s .chars() .map(|c| { if tables::non_ascii_space_character(c) { ' ' } else { c } }) .filter(|&c| !tables::commonly_mapped_to_nothing(c)); // 2.2 Normalization let normalized = mapped.nfkc().collect::(); // 2.3 Prohibited Output let prohibited = normalized.chars().find(|&c| { tables::non_ascii_space_character(c) /* C.1.2 */ || tables::ascii_control_character(c) /* C.2.1 */ || tables::non_ascii_control_character(c) /* C.2.2 */ || tables::private_use(c) /* C.3 */ || tables::non_character_code_point(c) /* C.4 */ || tables::surrogate_code(c) /* C.5 */ || tables::inappropriate_for_plain_text(c) /* C.6 */ || tables::inappropriate_for_canonical_representation(c) /* C.7 */ || tables::change_display_properties_or_deprecated(c) /* C.8 */ || tables::tagging_character(c) /* C.9 */ }); if let Some(c) = prohibited { return Err(Error(ErrorCause::ProhibitedCharacter(c))); } // 2.4. Bidirectional Characters if is_prohibited_bidirectional_text(&normalized) { return Err(Error(ErrorCause::ProhibitedBidirectionalText)); } // 2.5 Unassigned Code Points let unassigned = normalized .chars() .find(|&c| tables::unassigned_code_point(c)); if let Some(c) = unassigned { return Err(Error(ErrorCause::ProhibitedCharacter(c))); } Ok(Cow::Owned(normalized)) } // RFC3454, 6. Bidirectional Characters fn is_prohibited_bidirectional_text(s: &str) -> bool { if s.contains(tables::bidi_r_or_al) { // 2) If a string contains any RandALCat character, the string // MUST NOT contain any LCat character. if s.contains(tables::bidi_l) { return true; } // 3) If a string contains any RandALCat character, a RandALCat // character MUST be the first character of the string, and a // RandALCat character MUST be the last character of the string. if !tables::bidi_r_or_al(s.chars().next().unwrap()) || !tables::bidi_r_or_al(s.chars().next_back().unwrap()) { return true; } } false } /// Prepares a string with the Nameprep profile of the stringprep algorithm. /// /// Nameprep is defined in [RFC 3491][]. /// /// [RFC 3491]: https://tools.ietf.org/html/rfc3491 pub fn nameprep(s: &str) -> Result, Error> { // fast path for ascii text if s.chars() .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '.' || c == '-') { return Ok(Cow::Borrowed(s)); } // 3. Mapping let mapped = s .chars() .filter(|&c| !tables::commonly_mapped_to_nothing(c)) .flat_map(tables::case_fold_for_nfkc); // 4. Normalization let normalized = mapped.nfkc().collect::(); // 5. Prohibited Output let prohibited = normalized.chars().find(|&c| { tables::non_ascii_space_character(c) /* C.1.2 */ || tables::non_ascii_control_character(c) /* C.2.2 */ || tables::private_use(c) /* C.3 */ || tables::non_character_code_point(c) /* C.4 */ || tables::surrogate_code(c) /* C.5 */ || tables::inappropriate_for_plain_text(c) /* C.6 */ || tables::inappropriate_for_canonical_representation(c) /* C.7 */ || tables::change_display_properties_or_deprecated(c) /* C.9 */ || tables::tagging_character(c) /* C.9 */ }); if let Some(c) = prohibited { return Err(Error(ErrorCause::ProhibitedCharacter(c))); } // 6. Bidirectional Characters if is_prohibited_bidirectional_text(&normalized) { return Err(Error(ErrorCause::ProhibitedBidirectionalText)); } // 7 Unassigned Code Points let unassigned = normalized .chars() .find(|&c| tables::unassigned_code_point(c)); if let Some(c) = unassigned { return Err(Error(ErrorCause::ProhibitedCharacter(c))); } Ok(Cow::Owned(normalized)) } /// Prepares a string with the Nodeprep profile of the stringprep algorithm. /// /// Nameprep is defined in [RFC 3920, Appendix A][]. /// /// [RFC 3920, Appendix A]: https://tools.ietf.org/html/rfc3920#appendix-A pub fn nodeprep(s: &str) -> Result, Error> { // fast path for common ascii text if s.chars() .all(|c| matches!(c, '['..='~' | '0'..='9' | '('..='.' | '#'..='%')) { return Ok(Cow::Borrowed(s)); } // A.3. Mapping let mapped = s .chars() .filter(|&c| !tables::commonly_mapped_to_nothing(c)) .flat_map(tables::case_fold_for_nfkc); // A.4. Normalization let normalized = mapped.nfkc().collect::(); // A.5. Prohibited Output let prohibited = normalized.chars().find(|&c| { tables::ascii_space_character(c) /* C.1.1 */ || tables::non_ascii_space_character(c) /* C.1.2 */ || tables::ascii_control_character(c) /* C.2.1 */ || tables::non_ascii_control_character(c) /* C.2.2 */ || tables::private_use(c) /* C.3 */ || tables::non_character_code_point(c) /* C.4 */ || tables::surrogate_code(c) /* C.5 */ || tables::inappropriate_for_plain_text(c) /* C.6 */ || tables::inappropriate_for_canonical_representation(c) /* C.7 */ || tables::change_display_properties_or_deprecated(c) /* C.9 */ || tables::tagging_character(c) /* C.9 */ || prohibited_node_character(c) }); if let Some(c) = prohibited { return Err(Error(ErrorCause::ProhibitedCharacter(c))); } // A.6. Bidirectional Characters if is_prohibited_bidirectional_text(&normalized) { return Err(Error(ErrorCause::ProhibitedBidirectionalText)); } let unassigned = normalized .chars() .find(|&c| tables::unassigned_code_point(c)); if let Some(c) = unassigned { return Err(Error(ErrorCause::ProhibitedCharacter(c))); } Ok(Cow::Owned(normalized)) } // Additional characters not allowed in JID nodes, by RFC3920. fn prohibited_node_character(c: char) -> bool { matches!(c, '"' | '&' | '\'' | '/' | ':' | '<' | '>' | '@') } /// Prepares a string with the Resourceprep profile of the stringprep algorithm. /// /// Nameprep is defined in [RFC 3920, Appendix B][]. /// /// [RFC 3920, Appendix B]: https://tools.ietf.org/html/rfc3920#appendix-B pub fn resourceprep(s: &str) -> Result, Error> { // fast path for ascii text if s.chars().all(|c| matches!(c, ' '..='~')) { return Ok(Cow::Borrowed(s)); } // B.3. Mapping let mapped = s .chars() .filter(|&c| !tables::commonly_mapped_to_nothing(c)) .collect::(); // B.4. Normalization let normalized = mapped.nfkc().collect::(); // B.5. Prohibited Output let prohibited = normalized.chars().find(|&c| { tables::non_ascii_space_character(c) /* C.1.2 */ || tables::ascii_control_character(c) /* C.2.1 */ || tables::non_ascii_control_character(c) /* C.2.2 */ || tables::private_use(c) /* C.3 */ || tables::non_character_code_point(c) /* C.4 */ || tables::surrogate_code(c) /* C.5 */ || tables::inappropriate_for_plain_text(c) /* C.6 */ || tables::inappropriate_for_canonical_representation(c) /* C.7 */ || tables::change_display_properties_or_deprecated(c) /* C.9 */ || tables::tagging_character(c) /* C.9 */ }); if let Some(c) = prohibited { return Err(Error(ErrorCause::ProhibitedCharacter(c))); } // B.6. Bidirectional Characters if is_prohibited_bidirectional_text(&normalized) { return Err(Error(ErrorCause::ProhibitedBidirectionalText)); } let unassigned = normalized .chars() .find(|&c| tables::unassigned_code_point(c)); if let Some(c) = unassigned { return Err(Error(ErrorCause::ProhibitedCharacter(c))); } Ok(Cow::Owned(normalized)) } /// Prepares a string according to the procedures described in Section 7 of /// [ITU-T Recommendation X.520 (2019)](https://www.itu.int/rec/T-REC-X.520-201910-I/en). /// /// Note that this function does _not_ remove leading, trailing, or inner /// spaces as described in Section 7.6, because the characters needing removal /// will vary across the matching rules and ASN.1 syntaxes used. pub fn x520prep(s: &str, case_fold: bool) -> Result, Error> { if s.is_empty() { return Err(Error(ErrorCause::EmptyString)); } if s.chars() .all(|c| matches!(c, ' '..='~') && (!case_fold || c.is_ascii_lowercase())) { return Ok(Cow::Borrowed(s)); } // 1. Transcode // Already done because &str is enforced to be Unicode. // 2. Map let mapped = s .chars() .filter(|&c| !tables::x520_mapped_to_nothing(c)) .map(|c| { if tables::x520_mapped_to_space(c) { ' ' } else { c } }); // 3. Normalize let normalized = if case_fold { mapped .flat_map(tables::case_fold_for_nfkc) .collect::() } else { mapped.nfkc().collect::() }; // 4. Prohibit let prohibited = normalized.chars().find( |&c| { tables::unassigned_code_point(c) || tables::private_use(c) || tables::non_character_code_point(c) || tables::surrogate_code(c) || c == '\u{FFFD}' }, // REPLACEMENT CHARACTER ); if let Some(c) = prohibited { return Err(Error(ErrorCause::ProhibitedCharacter(c))); } // From ITU-T Recommendation X.520, Section 7.4: // "The first code point of a string is prohibited from being a combining character." match s.chars().next() { Some(c) => { if c.general_category_group() == GeneralCategoryGroup::Mark { return Err(Error(ErrorCause::StartsWithCombiningCharacter)); } } None => return Err(Error(ErrorCause::EmptyString)), } // 5. Check bidi // From ITU-T Recommendation X.520, Section 7.4: // "There are no bidirectional restrictions. The output string is the input string." // So there is nothing to do for this step. // 6. Insignificant Character Removal // Done in calling functions. Ok(normalized.into()) } #[cfg(test)] mod test { use super::*; fn assert_prohibited_character(result: Result) { match result { Err(Error(ErrorCause::ProhibitedCharacter(_))) => (), _ => panic!(), } } fn assert_starts_with_combining_char(result: Result) { match result { Err(Error(ErrorCause::StartsWithCombiningCharacter)) => (), _ => panic!(), } } // RFC4013, 3. Examples #[test] fn saslprep_examples() { assert_prohibited_character(saslprep("\u{0007}")); } #[test] fn nodeprep_examples() { assert_prohibited_character(nodeprep(" ")); assert_prohibited_character(nodeprep("\u{00a0}")); assert_prohibited_character(nodeprep("foo@bar")); } #[test] fn resourceprep_examples() { assert_eq!("foo@bar", resourceprep("foo@bar").unwrap()); } #[test] fn x520prep_examples() { assert_eq!(x520prep("foo@bar", true).unwrap(), "foo@bar"); assert_eq!( x520prep("J.\u{FE00} \u{9}W. \u{B}wuz h\u{0115}re", false).unwrap(), "J. W. wuz h\u{0115}re" ); assert_eq!( x520prep("J.\u{FE00} \u{9}W. \u{B}wuz h\u{0115}re", true).unwrap(), "j. w. wuz h\u{0115}re" ); assert_eq!(x520prep("UPPERCASED", true).unwrap(), "uppercased"); assert_starts_with_combining_char(x520prep("\u{0306}hello", true)); } #[test] fn ascii_optimisations() { if let Cow::Owned(_) = nodeprep("nodepart").unwrap() { panic!("“nodepart” should get optimised as ASCII"); } if let Cow::Owned(_) = nameprep("domainpart.example").unwrap() { panic!("“domainpart.example” should get optimised as ASCII"); } if let Cow::Owned(_) = resourceprep("resourcepart").unwrap() { panic!("“resourcepart” should get optimised as ASCII"); } } } stringprep-0.1.5/src/rfc3454.rs000064400000000000000000001537401046102023000142650ustar 00000000000000// AUTOGENERATED CODE - DO NOT EDIT pub const A_1: &[(char, char)] = &[ ('\u{0221}', '\u{0221}'), ('\u{0234}', '\u{024F}'), ('\u{02AE}', '\u{02AF}'), ('\u{02EF}', '\u{02FF}'), ('\u{0350}', '\u{035F}'), ('\u{0370}', '\u{0373}'), ('\u{0376}', '\u{0379}'), ('\u{037B}', '\u{037D}'), ('\u{037F}', '\u{0383}'), ('\u{038B}', '\u{038B}'), ('\u{038D}', '\u{038D}'), ('\u{03A2}', '\u{03A2}'), ('\u{03CF}', '\u{03CF}'), ('\u{03F7}', '\u{03FF}'), ('\u{0487}', '\u{0487}'), ('\u{04CF}', '\u{04CF}'), ('\u{04F6}', '\u{04F7}'), ('\u{04FA}', '\u{04FF}'), ('\u{0510}', '\u{0530}'), ('\u{0557}', '\u{0558}'), ('\u{0560}', '\u{0560}'), ('\u{0588}', '\u{0588}'), ('\u{058B}', '\u{0590}'), ('\u{05A2}', '\u{05A2}'), ('\u{05BA}', '\u{05BA}'), ('\u{05C5}', '\u{05CF}'), ('\u{05EB}', '\u{05EF}'), ('\u{05F5}', '\u{060B}'), ('\u{060D}', '\u{061A}'), ('\u{061C}', '\u{061E}'), ('\u{0620}', '\u{0620}'), ('\u{063B}', '\u{063F}'), ('\u{0656}', '\u{065F}'), ('\u{06EE}', '\u{06EF}'), ('\u{06FF}', '\u{06FF}'), ('\u{070E}', '\u{070E}'), ('\u{072D}', '\u{072F}'), ('\u{074B}', '\u{077F}'), ('\u{07B2}', '\u{0900}'), ('\u{0904}', '\u{0904}'), ('\u{093A}', '\u{093B}'), ('\u{094E}', '\u{094F}'), ('\u{0955}', '\u{0957}'), ('\u{0971}', '\u{0980}'), ('\u{0984}', '\u{0984}'), ('\u{098D}', '\u{098E}'), ('\u{0991}', '\u{0992}'), ('\u{09A9}', '\u{09A9}'), ('\u{09B1}', '\u{09B1}'), ('\u{09B3}', '\u{09B5}'), ('\u{09BA}', '\u{09BB}'), ('\u{09BD}', '\u{09BD}'), ('\u{09C5}', '\u{09C6}'), ('\u{09C9}', '\u{09CA}'), ('\u{09CE}', '\u{09D6}'), ('\u{09D8}', '\u{09DB}'), ('\u{09DE}', '\u{09DE}'), ('\u{09E4}', '\u{09E5}'), ('\u{09FB}', '\u{0A01}'), ('\u{0A03}', '\u{0A04}'), ('\u{0A0B}', '\u{0A0E}'), ('\u{0A11}', '\u{0A12}'), ('\u{0A29}', '\u{0A29}'), ('\u{0A31}', '\u{0A31}'), ('\u{0A34}', '\u{0A34}'), ('\u{0A37}', '\u{0A37}'), ('\u{0A3A}', '\u{0A3B}'), ('\u{0A3D}', '\u{0A3D}'), ('\u{0A43}', '\u{0A46}'), ('\u{0A49}', '\u{0A4A}'), ('\u{0A4E}', '\u{0A58}'), ('\u{0A5D}', '\u{0A5D}'), ('\u{0A5F}', '\u{0A65}'), ('\u{0A75}', '\u{0A80}'), ('\u{0A84}', '\u{0A84}'), ('\u{0A8C}', '\u{0A8C}'), ('\u{0A8E}', '\u{0A8E}'), ('\u{0A92}', '\u{0A92}'), ('\u{0AA9}', '\u{0AA9}'), ('\u{0AB1}', '\u{0AB1}'), ('\u{0AB4}', '\u{0AB4}'), ('\u{0ABA}', '\u{0ABB}'), ('\u{0AC6}', '\u{0AC6}'), ('\u{0ACA}', '\u{0ACA}'), ('\u{0ACE}', '\u{0ACF}'), ('\u{0AD1}', '\u{0ADF}'), ('\u{0AE1}', '\u{0AE5}'), ('\u{0AF0}', '\u{0B00}'), ('\u{0B04}', '\u{0B04}'), ('\u{0B0D}', '\u{0B0E}'), ('\u{0B11}', '\u{0B12}'), ('\u{0B29}', '\u{0B29}'), ('\u{0B31}', '\u{0B31}'), ('\u{0B34}', '\u{0B35}'), ('\u{0B3A}', '\u{0B3B}'), ('\u{0B44}', '\u{0B46}'), ('\u{0B49}', '\u{0B4A}'), ('\u{0B4E}', '\u{0B55}'), ('\u{0B58}', '\u{0B5B}'), ('\u{0B5E}', '\u{0B5E}'), ('\u{0B62}', '\u{0B65}'), ('\u{0B71}', '\u{0B81}'), ('\u{0B84}', '\u{0B84}'), ('\u{0B8B}', '\u{0B8D}'), ('\u{0B91}', '\u{0B91}'), ('\u{0B96}', '\u{0B98}'), ('\u{0B9B}', '\u{0B9B}'), ('\u{0B9D}', '\u{0B9D}'), ('\u{0BA0}', '\u{0BA2}'), ('\u{0BA5}', '\u{0BA7}'), ('\u{0BAB}', '\u{0BAD}'), ('\u{0BB6}', '\u{0BB6}'), ('\u{0BBA}', '\u{0BBD}'), ('\u{0BC3}', '\u{0BC5}'), ('\u{0BC9}', '\u{0BC9}'), ('\u{0BCE}', '\u{0BD6}'), ('\u{0BD8}', '\u{0BE6}'), ('\u{0BF3}', '\u{0C00}'), ('\u{0C04}', '\u{0C04}'), ('\u{0C0D}', '\u{0C0D}'), ('\u{0C11}', '\u{0C11}'), ('\u{0C29}', '\u{0C29}'), ('\u{0C34}', '\u{0C34}'), ('\u{0C3A}', '\u{0C3D}'), ('\u{0C45}', '\u{0C45}'), ('\u{0C49}', '\u{0C49}'), ('\u{0C4E}', '\u{0C54}'), ('\u{0C57}', '\u{0C5F}'), ('\u{0C62}', '\u{0C65}'), ('\u{0C70}', '\u{0C81}'), ('\u{0C84}', '\u{0C84}'), ('\u{0C8D}', '\u{0C8D}'), ('\u{0C91}', '\u{0C91}'), ('\u{0CA9}', '\u{0CA9}'), ('\u{0CB4}', '\u{0CB4}'), ('\u{0CBA}', '\u{0CBD}'), ('\u{0CC5}', '\u{0CC5}'), ('\u{0CC9}', '\u{0CC9}'), ('\u{0CCE}', '\u{0CD4}'), ('\u{0CD7}', '\u{0CDD}'), ('\u{0CDF}', '\u{0CDF}'), ('\u{0CE2}', '\u{0CE5}'), ('\u{0CF0}', '\u{0D01}'), ('\u{0D04}', '\u{0D04}'), ('\u{0D0D}', '\u{0D0D}'), ('\u{0D11}', '\u{0D11}'), ('\u{0D29}', '\u{0D29}'), ('\u{0D3A}', '\u{0D3D}'), ('\u{0D44}', '\u{0D45}'), ('\u{0D49}', '\u{0D49}'), ('\u{0D4E}', '\u{0D56}'), ('\u{0D58}', '\u{0D5F}'), ('\u{0D62}', '\u{0D65}'), ('\u{0D70}', '\u{0D81}'), ('\u{0D84}', '\u{0D84}'), ('\u{0D97}', '\u{0D99}'), ('\u{0DB2}', '\u{0DB2}'), ('\u{0DBC}', '\u{0DBC}'), ('\u{0DBE}', '\u{0DBF}'), ('\u{0DC7}', '\u{0DC9}'), ('\u{0DCB}', '\u{0DCE}'), ('\u{0DD5}', '\u{0DD5}'), ('\u{0DD7}', '\u{0DD7}'), ('\u{0DE0}', '\u{0DF1}'), ('\u{0DF5}', '\u{0E00}'), ('\u{0E3B}', '\u{0E3E}'), ('\u{0E5C}', '\u{0E80}'), ('\u{0E83}', '\u{0E83}'), ('\u{0E85}', '\u{0E86}'), ('\u{0E89}', '\u{0E89}'), ('\u{0E8B}', '\u{0E8C}'), ('\u{0E8E}', '\u{0E93}'), ('\u{0E98}', '\u{0E98}'), ('\u{0EA0}', '\u{0EA0}'), ('\u{0EA4}', '\u{0EA4}'), ('\u{0EA6}', '\u{0EA6}'), ('\u{0EA8}', '\u{0EA9}'), ('\u{0EAC}', '\u{0EAC}'), ('\u{0EBA}', '\u{0EBA}'), ('\u{0EBE}', '\u{0EBF}'), ('\u{0EC5}', '\u{0EC5}'), ('\u{0EC7}', '\u{0EC7}'), ('\u{0ECE}', '\u{0ECF}'), ('\u{0EDA}', '\u{0EDB}'), ('\u{0EDE}', '\u{0EFF}'), ('\u{0F48}', '\u{0F48}'), ('\u{0F6B}', '\u{0F70}'), ('\u{0F8C}', '\u{0F8F}'), ('\u{0F98}', '\u{0F98}'), ('\u{0FBD}', '\u{0FBD}'), ('\u{0FCD}', '\u{0FCE}'), ('\u{0FD0}', '\u{0FFF}'), ('\u{1022}', '\u{1022}'), ('\u{1028}', '\u{1028}'), ('\u{102B}', '\u{102B}'), ('\u{1033}', '\u{1035}'), ('\u{103A}', '\u{103F}'), ('\u{105A}', '\u{109F}'), ('\u{10C6}', '\u{10CF}'), ('\u{10F9}', '\u{10FA}'), ('\u{10FC}', '\u{10FF}'), ('\u{115A}', '\u{115E}'), ('\u{11A3}', '\u{11A7}'), ('\u{11FA}', '\u{11FF}'), ('\u{1207}', '\u{1207}'), ('\u{1247}', '\u{1247}'), ('\u{1249}', '\u{1249}'), ('\u{124E}', '\u{124F}'), ('\u{1257}', '\u{1257}'), ('\u{1259}', '\u{1259}'), ('\u{125E}', '\u{125F}'), ('\u{1287}', '\u{1287}'), ('\u{1289}', '\u{1289}'), ('\u{128E}', '\u{128F}'), ('\u{12AF}', '\u{12AF}'), ('\u{12B1}', '\u{12B1}'), ('\u{12B6}', '\u{12B7}'), ('\u{12BF}', '\u{12BF}'), ('\u{12C1}', '\u{12C1}'), ('\u{12C6}', '\u{12C7}'), ('\u{12CF}', '\u{12CF}'), ('\u{12D7}', '\u{12D7}'), ('\u{12EF}', '\u{12EF}'), ('\u{130F}', '\u{130F}'), ('\u{1311}', '\u{1311}'), ('\u{1316}', '\u{1317}'), ('\u{131F}', '\u{131F}'), ('\u{1347}', '\u{1347}'), ('\u{135B}', '\u{1360}'), ('\u{137D}', '\u{139F}'), ('\u{13F5}', '\u{1400}'), ('\u{1677}', '\u{167F}'), ('\u{169D}', '\u{169F}'), ('\u{16F1}', '\u{16FF}'), ('\u{170D}', '\u{170D}'), ('\u{1715}', '\u{171F}'), ('\u{1737}', '\u{173F}'), ('\u{1754}', '\u{175F}'), ('\u{176D}', '\u{176D}'), ('\u{1771}', '\u{1771}'), ('\u{1774}', '\u{177F}'), ('\u{17DD}', '\u{17DF}'), ('\u{17EA}', '\u{17FF}'), ('\u{180F}', '\u{180F}'), ('\u{181A}', '\u{181F}'), ('\u{1878}', '\u{187F}'), ('\u{18AA}', '\u{1DFF}'), ('\u{1E9C}', '\u{1E9F}'), ('\u{1EFA}', '\u{1EFF}'), ('\u{1F16}', '\u{1F17}'), ('\u{1F1E}', '\u{1F1F}'), ('\u{1F46}', '\u{1F47}'), ('\u{1F4E}', '\u{1F4F}'), ('\u{1F58}', '\u{1F58}'), ('\u{1F5A}', '\u{1F5A}'), ('\u{1F5C}', '\u{1F5C}'), ('\u{1F5E}', '\u{1F5E}'), ('\u{1F7E}', '\u{1F7F}'), ('\u{1FB5}', '\u{1FB5}'), ('\u{1FC5}', '\u{1FC5}'), ('\u{1FD4}', '\u{1FD5}'), ('\u{1FDC}', '\u{1FDC}'), ('\u{1FF0}', '\u{1FF1}'), ('\u{1FF5}', '\u{1FF5}'), ('\u{1FFF}', '\u{1FFF}'), ('\u{2053}', '\u{2056}'), ('\u{2058}', '\u{205E}'), ('\u{2064}', '\u{2069}'), ('\u{2072}', '\u{2073}'), ('\u{208F}', '\u{209F}'), ('\u{20B2}', '\u{20CF}'), ('\u{20EB}', '\u{20FF}'), ('\u{213B}', '\u{213C}'), ('\u{214C}', '\u{2152}'), ('\u{2184}', '\u{218F}'), ('\u{23CF}', '\u{23FF}'), ('\u{2427}', '\u{243F}'), ('\u{244B}', '\u{245F}'), ('\u{24FF}', '\u{24FF}'), ('\u{2614}', '\u{2615}'), ('\u{2618}', '\u{2618}'), ('\u{267E}', '\u{267F}'), ('\u{268A}', '\u{2700}'), ('\u{2705}', '\u{2705}'), ('\u{270A}', '\u{270B}'), ('\u{2728}', '\u{2728}'), ('\u{274C}', '\u{274C}'), ('\u{274E}', '\u{274E}'), ('\u{2753}', '\u{2755}'), ('\u{2757}', '\u{2757}'), ('\u{275F}', '\u{2760}'), ('\u{2795}', '\u{2797}'), ('\u{27B0}', '\u{27B0}'), ('\u{27BF}', '\u{27CF}'), ('\u{27EC}', '\u{27EF}'), ('\u{2B00}', '\u{2E7F}'), ('\u{2E9A}', '\u{2E9A}'), ('\u{2EF4}', '\u{2EFF}'), ('\u{2FD6}', '\u{2FEF}'), ('\u{2FFC}', '\u{2FFF}'), ('\u{3040}', '\u{3040}'), ('\u{3097}', '\u{3098}'), ('\u{3100}', '\u{3104}'), ('\u{312D}', '\u{3130}'), ('\u{318F}', '\u{318F}'), ('\u{31B8}', '\u{31EF}'), ('\u{321D}', '\u{321F}'), ('\u{3244}', '\u{3250}'), ('\u{327C}', '\u{327E}'), ('\u{32CC}', '\u{32CF}'), ('\u{32FF}', '\u{32FF}'), ('\u{3377}', '\u{337A}'), ('\u{33DE}', '\u{33DF}'), ('\u{33FF}', '\u{33FF}'), ('\u{4DB6}', '\u{4DFF}'), ('\u{9FA6}', '\u{9FFF}'), ('\u{A48D}', '\u{A48F}'), ('\u{A4C7}', '\u{ABFF}'), ('\u{D7A4}', '\u{D7FF}'), ('\u{FA2E}', '\u{FA2F}'), ('\u{FA6B}', '\u{FAFF}'), ('\u{FB07}', '\u{FB12}'), ('\u{FB18}', '\u{FB1C}'), ('\u{FB37}', '\u{FB37}'), ('\u{FB3D}', '\u{FB3D}'), ('\u{FB3F}', '\u{FB3F}'), ('\u{FB42}', '\u{FB42}'), ('\u{FB45}', '\u{FB45}'), ('\u{FBB2}', '\u{FBD2}'), ('\u{FD40}', '\u{FD4F}'), ('\u{FD90}', '\u{FD91}'), ('\u{FDC8}', '\u{FDCF}'), ('\u{FDFD}', '\u{FDFF}'), ('\u{FE10}', '\u{FE1F}'), ('\u{FE24}', '\u{FE2F}'), ('\u{FE47}', '\u{FE48}'), ('\u{FE53}', '\u{FE53}'), ('\u{FE67}', '\u{FE67}'), ('\u{FE6C}', '\u{FE6F}'), ('\u{FE75}', '\u{FE75}'), ('\u{FEFD}', '\u{FEFE}'), ('\u{FF00}', '\u{FF00}'), ('\u{FFBF}', '\u{FFC1}'), ('\u{FFC8}', '\u{FFC9}'), ('\u{FFD0}', '\u{FFD1}'), ('\u{FFD8}', '\u{FFD9}'), ('\u{FFDD}', '\u{FFDF}'), ('\u{FFE7}', '\u{FFE7}'), ('\u{FFEF}', '\u{FFF8}'), ('\u{10000}', '\u{102FF}'), ('\u{1031F}', '\u{1031F}'), ('\u{10324}', '\u{1032F}'), ('\u{1034B}', '\u{103FF}'), ('\u{10426}', '\u{10427}'), ('\u{1044E}', '\u{1CFFF}'), ('\u{1D0F6}', '\u{1D0FF}'), ('\u{1D127}', '\u{1D129}'), ('\u{1D1DE}', '\u{1D3FF}'), ('\u{1D455}', '\u{1D455}'), ('\u{1D49D}', '\u{1D49D}'), ('\u{1D4A0}', '\u{1D4A1}'), ('\u{1D4A3}', '\u{1D4A4}'), ('\u{1D4A7}', '\u{1D4A8}'), ('\u{1D4AD}', '\u{1D4AD}'), ('\u{1D4BA}', '\u{1D4BA}'), ('\u{1D4BC}', '\u{1D4BC}'), ('\u{1D4C1}', '\u{1D4C1}'), ('\u{1D4C4}', '\u{1D4C4}'), ('\u{1D506}', '\u{1D506}'), ('\u{1D50B}', '\u{1D50C}'), ('\u{1D515}', '\u{1D515}'), ('\u{1D51D}', '\u{1D51D}'), ('\u{1D53A}', '\u{1D53A}'), ('\u{1D53F}', '\u{1D53F}'), ('\u{1D545}', '\u{1D545}'), ('\u{1D547}', '\u{1D549}'), ('\u{1D551}', '\u{1D551}'), ('\u{1D6A4}', '\u{1D6A7}'), ('\u{1D7CA}', '\u{1D7CD}'), ('\u{1D800}', '\u{1FFFD}'), ('\u{2A6D7}', '\u{2F7FF}'), ('\u{2FA1E}', '\u{2FFFD}'), ('\u{30000}', '\u{3FFFD}'), ('\u{40000}', '\u{4FFFD}'), ('\u{50000}', '\u{5FFFD}'), ('\u{60000}', '\u{6FFFD}'), ('\u{70000}', '\u{7FFFD}'), ('\u{80000}', '\u{8FFFD}'), ('\u{90000}', '\u{9FFFD}'), ('\u{A0000}', '\u{AFFFD}'), ('\u{B0000}', '\u{BFFFD}'), ('\u{C0000}', '\u{CFFFD}'), ('\u{D0000}', '\u{DFFFD}'), ('\u{E0000}', '\u{E0000}'), ('\u{E0002}', '\u{E001F}'), ('\u{E0080}', '\u{EFFFD}'), ]; pub const B_2: &[(char, &str)] = &[ ('\u{0041}', "\u{0061}"), ('\u{0042}', "\u{0062}"), ('\u{0043}', "\u{0063}"), ('\u{0044}', "\u{0064}"), ('\u{0045}', "\u{0065}"), ('\u{0046}', "\u{0066}"), ('\u{0047}', "\u{0067}"), ('\u{0048}', "\u{0068}"), ('\u{0049}', "\u{0069}"), ('\u{004A}', "\u{006A}"), ('\u{004B}', "\u{006B}"), ('\u{004C}', "\u{006C}"), ('\u{004D}', "\u{006D}"), ('\u{004E}', "\u{006E}"), ('\u{004F}', "\u{006F}"), ('\u{0050}', "\u{0070}"), ('\u{0051}', "\u{0071}"), ('\u{0052}', "\u{0072}"), ('\u{0053}', "\u{0073}"), ('\u{0054}', "\u{0074}"), ('\u{0055}', "\u{0075}"), ('\u{0056}', "\u{0076}"), ('\u{0057}', "\u{0077}"), ('\u{0058}', "\u{0078}"), ('\u{0059}', "\u{0079}"), ('\u{005A}', "\u{007A}"), ('\u{00B5}', "\u{03BC}"), ('\u{00C0}', "\u{00E0}"), ('\u{00C1}', "\u{00E1}"), ('\u{00C2}', "\u{00E2}"), ('\u{00C3}', "\u{00E3}"), ('\u{00C4}', "\u{00E4}"), ('\u{00C5}', "\u{00E5}"), ('\u{00C6}', "\u{00E6}"), ('\u{00C7}', "\u{00E7}"), ('\u{00C8}', "\u{00E8}"), ('\u{00C9}', "\u{00E9}"), ('\u{00CA}', "\u{00EA}"), ('\u{00CB}', "\u{00EB}"), ('\u{00CC}', "\u{00EC}"), ('\u{00CD}', "\u{00ED}"), ('\u{00CE}', "\u{00EE}"), ('\u{00CF}', "\u{00EF}"), ('\u{00D0}', "\u{00F0}"), ('\u{00D1}', "\u{00F1}"), ('\u{00D2}', "\u{00F2}"), ('\u{00D3}', "\u{00F3}"), ('\u{00D4}', "\u{00F4}"), ('\u{00D5}', "\u{00F5}"), ('\u{00D6}', "\u{00F6}"), ('\u{00D8}', "\u{00F8}"), ('\u{00D9}', "\u{00F9}"), ('\u{00DA}', "\u{00FA}"), ('\u{00DB}', "\u{00FB}"), ('\u{00DC}', "\u{00FC}"), ('\u{00DD}', "\u{00FD}"), ('\u{00DE}', "\u{00FE}"), ('\u{00DF}', "\u{0073}\u{0073}"), ('\u{0100}', "\u{0101}"), ('\u{0102}', "\u{0103}"), ('\u{0104}', "\u{0105}"), ('\u{0106}', "\u{0107}"), ('\u{0108}', "\u{0109}"), ('\u{010A}', "\u{010B}"), ('\u{010C}', "\u{010D}"), ('\u{010E}', "\u{010F}"), ('\u{0110}', "\u{0111}"), ('\u{0112}', "\u{0113}"), ('\u{0114}', "\u{0115}"), ('\u{0116}', "\u{0117}"), ('\u{0118}', "\u{0119}"), ('\u{011A}', "\u{011B}"), ('\u{011C}', "\u{011D}"), ('\u{011E}', "\u{011F}"), ('\u{0120}', "\u{0121}"), ('\u{0122}', "\u{0123}"), ('\u{0124}', "\u{0125}"), ('\u{0126}', "\u{0127}"), ('\u{0128}', "\u{0129}"), ('\u{012A}', "\u{012B}"), ('\u{012C}', "\u{012D}"), ('\u{012E}', "\u{012F}"), ('\u{0130}', "\u{0069}\u{0307}"), ('\u{0132}', "\u{0133}"), ('\u{0134}', "\u{0135}"), ('\u{0136}', "\u{0137}"), ('\u{0139}', "\u{013A}"), ('\u{013B}', "\u{013C}"), ('\u{013D}', "\u{013E}"), ('\u{013F}', "\u{0140}"), ('\u{0141}', "\u{0142}"), ('\u{0143}', "\u{0144}"), ('\u{0145}', "\u{0146}"), ('\u{0147}', "\u{0148}"), ('\u{0149}', "\u{02BC}\u{006E}"), ('\u{014A}', "\u{014B}"), ('\u{014C}', "\u{014D}"), ('\u{014E}', "\u{014F}"), ('\u{0150}', "\u{0151}"), ('\u{0152}', "\u{0153}"), ('\u{0154}', "\u{0155}"), ('\u{0156}', "\u{0157}"), ('\u{0158}', "\u{0159}"), ('\u{015A}', "\u{015B}"), ('\u{015C}', "\u{015D}"), ('\u{015E}', "\u{015F}"), ('\u{0160}', "\u{0161}"), ('\u{0162}', "\u{0163}"), ('\u{0164}', "\u{0165}"), ('\u{0166}', "\u{0167}"), ('\u{0168}', "\u{0169}"), ('\u{016A}', "\u{016B}"), ('\u{016C}', "\u{016D}"), ('\u{016E}', "\u{016F}"), ('\u{0170}', "\u{0171}"), ('\u{0172}', "\u{0173}"), ('\u{0174}', "\u{0175}"), ('\u{0176}', "\u{0177}"), ('\u{0178}', "\u{00FF}"), ('\u{0179}', "\u{017A}"), ('\u{017B}', "\u{017C}"), ('\u{017D}', "\u{017E}"), ('\u{017F}', "\u{0073}"), ('\u{0181}', "\u{0253}"), ('\u{0182}', "\u{0183}"), ('\u{0184}', "\u{0185}"), ('\u{0186}', "\u{0254}"), ('\u{0187}', "\u{0188}"), ('\u{0189}', "\u{0256}"), ('\u{018A}', "\u{0257}"), ('\u{018B}', "\u{018C}"), ('\u{018E}', "\u{01DD}"), ('\u{018F}', "\u{0259}"), ('\u{0190}', "\u{025B}"), ('\u{0191}', "\u{0192}"), ('\u{0193}', "\u{0260}"), ('\u{0194}', "\u{0263}"), ('\u{0196}', "\u{0269}"), ('\u{0197}', "\u{0268}"), ('\u{0198}', "\u{0199}"), ('\u{019C}', "\u{026F}"), ('\u{019D}', "\u{0272}"), ('\u{019F}', "\u{0275}"), ('\u{01A0}', "\u{01A1}"), ('\u{01A2}', "\u{01A3}"), ('\u{01A4}', "\u{01A5}"), ('\u{01A6}', "\u{0280}"), ('\u{01A7}', "\u{01A8}"), ('\u{01A9}', "\u{0283}"), ('\u{01AC}', "\u{01AD}"), ('\u{01AE}', "\u{0288}"), ('\u{01AF}', "\u{01B0}"), ('\u{01B1}', "\u{028A}"), ('\u{01B2}', "\u{028B}"), ('\u{01B3}', "\u{01B4}"), ('\u{01B5}', "\u{01B6}"), ('\u{01B7}', "\u{0292}"), ('\u{01B8}', "\u{01B9}"), ('\u{01BC}', "\u{01BD}"), ('\u{01C4}', "\u{01C6}"), ('\u{01C5}', "\u{01C6}"), ('\u{01C7}', "\u{01C9}"), ('\u{01C8}', "\u{01C9}"), ('\u{01CA}', "\u{01CC}"), ('\u{01CB}', "\u{01CC}"), ('\u{01CD}', "\u{01CE}"), ('\u{01CF}', "\u{01D0}"), ('\u{01D1}', "\u{01D2}"), ('\u{01D3}', "\u{01D4}"), ('\u{01D5}', "\u{01D6}"), ('\u{01D7}', "\u{01D8}"), ('\u{01D9}', "\u{01DA}"), ('\u{01DB}', "\u{01DC}"), ('\u{01DE}', "\u{01DF}"), ('\u{01E0}', "\u{01E1}"), ('\u{01E2}', "\u{01E3}"), ('\u{01E4}', "\u{01E5}"), ('\u{01E6}', "\u{01E7}"), ('\u{01E8}', "\u{01E9}"), ('\u{01EA}', "\u{01EB}"), ('\u{01EC}', "\u{01ED}"), ('\u{01EE}', "\u{01EF}"), ('\u{01F0}', "\u{006A}\u{030C}"), ('\u{01F1}', "\u{01F3}"), ('\u{01F2}', "\u{01F3}"), ('\u{01F4}', "\u{01F5}"), ('\u{01F6}', "\u{0195}"), ('\u{01F7}', "\u{01BF}"), ('\u{01F8}', "\u{01F9}"), ('\u{01FA}', "\u{01FB}"), ('\u{01FC}', "\u{01FD}"), ('\u{01FE}', "\u{01FF}"), ('\u{0200}', "\u{0201}"), ('\u{0202}', "\u{0203}"), ('\u{0204}', "\u{0205}"), ('\u{0206}', "\u{0207}"), ('\u{0208}', "\u{0209}"), ('\u{020A}', "\u{020B}"), ('\u{020C}', "\u{020D}"), ('\u{020E}', "\u{020F}"), ('\u{0210}', "\u{0211}"), ('\u{0212}', "\u{0213}"), ('\u{0214}', "\u{0215}"), ('\u{0216}', "\u{0217}"), ('\u{0218}', "\u{0219}"), ('\u{021A}', "\u{021B}"), ('\u{021C}', "\u{021D}"), ('\u{021E}', "\u{021F}"), ('\u{0220}', "\u{019E}"), ('\u{0222}', "\u{0223}"), ('\u{0224}', "\u{0225}"), ('\u{0226}', "\u{0227}"), ('\u{0228}', "\u{0229}"), ('\u{022A}', "\u{022B}"), ('\u{022C}', "\u{022D}"), ('\u{022E}', "\u{022F}"), ('\u{0230}', "\u{0231}"), ('\u{0232}', "\u{0233}"), ('\u{0345}', "\u{03B9}"), ('\u{037A}', "\u{0020}\u{03B9}"), ('\u{0386}', "\u{03AC}"), ('\u{0388}', "\u{03AD}"), ('\u{0389}', "\u{03AE}"), ('\u{038A}', "\u{03AF}"), ('\u{038C}', "\u{03CC}"), ('\u{038E}', "\u{03CD}"), ('\u{038F}', "\u{03CE}"), ('\u{0390}', "\u{03B9}\u{0308}\u{0301}"), ('\u{0391}', "\u{03B1}"), ('\u{0392}', "\u{03B2}"), ('\u{0393}', "\u{03B3}"), ('\u{0394}', "\u{03B4}"), ('\u{0395}', "\u{03B5}"), ('\u{0396}', "\u{03B6}"), ('\u{0397}', "\u{03B7}"), ('\u{0398}', "\u{03B8}"), ('\u{0399}', "\u{03B9}"), ('\u{039A}', "\u{03BA}"), ('\u{039B}', "\u{03BB}"), ('\u{039C}', "\u{03BC}"), ('\u{039D}', "\u{03BD}"), ('\u{039E}', "\u{03BE}"), ('\u{039F}', "\u{03BF}"), ('\u{03A0}', "\u{03C0}"), ('\u{03A1}', "\u{03C1}"), ('\u{03A3}', "\u{03C3}"), ('\u{03A4}', "\u{03C4}"), ('\u{03A5}', "\u{03C5}"), ('\u{03A6}', "\u{03C6}"), ('\u{03A7}', "\u{03C7}"), ('\u{03A8}', "\u{03C8}"), ('\u{03A9}', "\u{03C9}"), ('\u{03AA}', "\u{03CA}"), ('\u{03AB}', "\u{03CB}"), ('\u{03B0}', "\u{03C5}\u{0308}\u{0301}"), ('\u{03C2}', "\u{03C3}"), ('\u{03D0}', "\u{03B2}"), ('\u{03D1}', "\u{03B8}"), ('\u{03D2}', "\u{03C5}"), ('\u{03D3}', "\u{03CD}"), ('\u{03D4}', "\u{03CB}"), ('\u{03D5}', "\u{03C6}"), ('\u{03D6}', "\u{03C0}"), ('\u{03D8}', "\u{03D9}"), ('\u{03DA}', "\u{03DB}"), ('\u{03DC}', "\u{03DD}"), ('\u{03DE}', "\u{03DF}"), ('\u{03E0}', "\u{03E1}"), ('\u{03E2}', "\u{03E3}"), ('\u{03E4}', "\u{03E5}"), ('\u{03E6}', "\u{03E7}"), ('\u{03E8}', "\u{03E9}"), ('\u{03EA}', "\u{03EB}"), ('\u{03EC}', "\u{03ED}"), ('\u{03EE}', "\u{03EF}"), ('\u{03F0}', "\u{03BA}"), ('\u{03F1}', "\u{03C1}"), ('\u{03F2}', "\u{03C3}"), ('\u{03F4}', "\u{03B8}"), ('\u{03F5}', "\u{03B5}"), ('\u{0400}', "\u{0450}"), ('\u{0401}', "\u{0451}"), ('\u{0402}', "\u{0452}"), ('\u{0403}', "\u{0453}"), ('\u{0404}', "\u{0454}"), ('\u{0405}', "\u{0455}"), ('\u{0406}', "\u{0456}"), ('\u{0407}', "\u{0457}"), ('\u{0408}', "\u{0458}"), ('\u{0409}', "\u{0459}"), ('\u{040A}', "\u{045A}"), ('\u{040B}', "\u{045B}"), ('\u{040C}', "\u{045C}"), ('\u{040D}', "\u{045D}"), ('\u{040E}', "\u{045E}"), ('\u{040F}', "\u{045F}"), ('\u{0410}', "\u{0430}"), ('\u{0411}', "\u{0431}"), ('\u{0412}', "\u{0432}"), ('\u{0413}', "\u{0433}"), ('\u{0414}', "\u{0434}"), ('\u{0415}', "\u{0435}"), ('\u{0416}', "\u{0436}"), ('\u{0417}', "\u{0437}"), ('\u{0418}', "\u{0438}"), ('\u{0419}', "\u{0439}"), ('\u{041A}', "\u{043A}"), ('\u{041B}', "\u{043B}"), ('\u{041C}', "\u{043C}"), ('\u{041D}', "\u{043D}"), ('\u{041E}', "\u{043E}"), ('\u{041F}', "\u{043F}"), ('\u{0420}', "\u{0440}"), ('\u{0421}', "\u{0441}"), ('\u{0422}', "\u{0442}"), ('\u{0423}', "\u{0443}"), ('\u{0424}', "\u{0444}"), ('\u{0425}', "\u{0445}"), ('\u{0426}', "\u{0446}"), ('\u{0427}', "\u{0447}"), ('\u{0428}', "\u{0448}"), ('\u{0429}', "\u{0449}"), ('\u{042A}', "\u{044A}"), ('\u{042B}', "\u{044B}"), ('\u{042C}', "\u{044C}"), ('\u{042D}', "\u{044D}"), ('\u{042E}', "\u{044E}"), ('\u{042F}', "\u{044F}"), ('\u{0460}', "\u{0461}"), ('\u{0462}', "\u{0463}"), ('\u{0464}', "\u{0465}"), ('\u{0466}', "\u{0467}"), ('\u{0468}', "\u{0469}"), ('\u{046A}', "\u{046B}"), ('\u{046C}', "\u{046D}"), ('\u{046E}', "\u{046F}"), ('\u{0470}', "\u{0471}"), ('\u{0472}', "\u{0473}"), ('\u{0474}', "\u{0475}"), ('\u{0476}', "\u{0477}"), ('\u{0478}', "\u{0479}"), ('\u{047A}', "\u{047B}"), ('\u{047C}', "\u{047D}"), ('\u{047E}', "\u{047F}"), ('\u{0480}', "\u{0481}"), ('\u{048A}', "\u{048B}"), ('\u{048C}', "\u{048D}"), ('\u{048E}', "\u{048F}"), ('\u{0490}', "\u{0491}"), ('\u{0492}', "\u{0493}"), ('\u{0494}', "\u{0495}"), ('\u{0496}', "\u{0497}"), ('\u{0498}', "\u{0499}"), ('\u{049A}', "\u{049B}"), ('\u{049C}', "\u{049D}"), ('\u{049E}', "\u{049F}"), ('\u{04A0}', "\u{04A1}"), ('\u{04A2}', "\u{04A3}"), ('\u{04A4}', "\u{04A5}"), ('\u{04A6}', "\u{04A7}"), ('\u{04A8}', "\u{04A9}"), ('\u{04AA}', "\u{04AB}"), ('\u{04AC}', "\u{04AD}"), ('\u{04AE}', "\u{04AF}"), ('\u{04B0}', "\u{04B1}"), ('\u{04B2}', "\u{04B3}"), ('\u{04B4}', "\u{04B5}"), ('\u{04B6}', "\u{04B7}"), ('\u{04B8}', "\u{04B9}"), ('\u{04BA}', "\u{04BB}"), ('\u{04BC}', "\u{04BD}"), ('\u{04BE}', "\u{04BF}"), ('\u{04C1}', "\u{04C2}"), ('\u{04C3}', "\u{04C4}"), ('\u{04C5}', "\u{04C6}"), ('\u{04C7}', "\u{04C8}"), ('\u{04C9}', "\u{04CA}"), ('\u{04CB}', "\u{04CC}"), ('\u{04CD}', "\u{04CE}"), ('\u{04D0}', "\u{04D1}"), ('\u{04D2}', "\u{04D3}"), ('\u{04D4}', "\u{04D5}"), ('\u{04D6}', "\u{04D7}"), ('\u{04D8}', "\u{04D9}"), ('\u{04DA}', "\u{04DB}"), ('\u{04DC}', "\u{04DD}"), ('\u{04DE}', "\u{04DF}"), ('\u{04E0}', "\u{04E1}"), ('\u{04E2}', "\u{04E3}"), ('\u{04E4}', "\u{04E5}"), ('\u{04E6}', "\u{04E7}"), ('\u{04E8}', "\u{04E9}"), ('\u{04EA}', "\u{04EB}"), ('\u{04EC}', "\u{04ED}"), ('\u{04EE}', "\u{04EF}"), ('\u{04F0}', "\u{04F1}"), ('\u{04F2}', "\u{04F3}"), ('\u{04F4}', "\u{04F5}"), ('\u{04F8}', "\u{04F9}"), ('\u{0500}', "\u{0501}"), ('\u{0502}', "\u{0503}"), ('\u{0504}', "\u{0505}"), ('\u{0506}', "\u{0507}"), ('\u{0508}', "\u{0509}"), ('\u{050A}', "\u{050B}"), ('\u{050C}', "\u{050D}"), ('\u{050E}', "\u{050F}"), ('\u{0531}', "\u{0561}"), ('\u{0532}', "\u{0562}"), ('\u{0533}', "\u{0563}"), ('\u{0534}', "\u{0564}"), ('\u{0535}', "\u{0565}"), ('\u{0536}', "\u{0566}"), ('\u{0537}', "\u{0567}"), ('\u{0538}', "\u{0568}"), ('\u{0539}', "\u{0569}"), ('\u{053A}', "\u{056A}"), ('\u{053B}', "\u{056B}"), ('\u{053C}', "\u{056C}"), ('\u{053D}', "\u{056D}"), ('\u{053E}', "\u{056E}"), ('\u{053F}', "\u{056F}"), ('\u{0540}', "\u{0570}"), ('\u{0541}', "\u{0571}"), ('\u{0542}', "\u{0572}"), ('\u{0543}', "\u{0573}"), ('\u{0544}', "\u{0574}"), ('\u{0545}', "\u{0575}"), ('\u{0546}', "\u{0576}"), ('\u{0547}', "\u{0577}"), ('\u{0548}', "\u{0578}"), ('\u{0549}', "\u{0579}"), ('\u{054A}', "\u{057A}"), ('\u{054B}', "\u{057B}"), ('\u{054C}', "\u{057C}"), ('\u{054D}', "\u{057D}"), ('\u{054E}', "\u{057E}"), ('\u{054F}', "\u{057F}"), ('\u{0550}', "\u{0580}"), ('\u{0551}', "\u{0581}"), ('\u{0552}', "\u{0582}"), ('\u{0553}', "\u{0583}"), ('\u{0554}', "\u{0584}"), ('\u{0555}', "\u{0585}"), ('\u{0556}', "\u{0586}"), ('\u{0587}', "\u{0565}\u{0582}"), ('\u{1E00}', "\u{1E01}"), ('\u{1E02}', "\u{1E03}"), ('\u{1E04}', "\u{1E05}"), ('\u{1E06}', "\u{1E07}"), ('\u{1E08}', "\u{1E09}"), ('\u{1E0A}', "\u{1E0B}"), ('\u{1E0C}', "\u{1E0D}"), ('\u{1E0E}', "\u{1E0F}"), ('\u{1E10}', "\u{1E11}"), ('\u{1E12}', "\u{1E13}"), ('\u{1E14}', "\u{1E15}"), ('\u{1E16}', "\u{1E17}"), ('\u{1E18}', "\u{1E19}"), ('\u{1E1A}', "\u{1E1B}"), ('\u{1E1C}', "\u{1E1D}"), ('\u{1E1E}', "\u{1E1F}"), ('\u{1E20}', "\u{1E21}"), ('\u{1E22}', "\u{1E23}"), ('\u{1E24}', "\u{1E25}"), ('\u{1E26}', "\u{1E27}"), ('\u{1E28}', "\u{1E29}"), ('\u{1E2A}', "\u{1E2B}"), ('\u{1E2C}', "\u{1E2D}"), ('\u{1E2E}', "\u{1E2F}"), ('\u{1E30}', "\u{1E31}"), ('\u{1E32}', "\u{1E33}"), ('\u{1E34}', "\u{1E35}"), ('\u{1E36}', "\u{1E37}"), ('\u{1E38}', "\u{1E39}"), ('\u{1E3A}', "\u{1E3B}"), ('\u{1E3C}', "\u{1E3D}"), ('\u{1E3E}', "\u{1E3F}"), ('\u{1E40}', "\u{1E41}"), ('\u{1E42}', "\u{1E43}"), ('\u{1E44}', "\u{1E45}"), ('\u{1E46}', "\u{1E47}"), ('\u{1E48}', "\u{1E49}"), ('\u{1E4A}', "\u{1E4B}"), ('\u{1E4C}', "\u{1E4D}"), ('\u{1E4E}', "\u{1E4F}"), ('\u{1E50}', "\u{1E51}"), ('\u{1E52}', "\u{1E53}"), ('\u{1E54}', "\u{1E55}"), ('\u{1E56}', "\u{1E57}"), ('\u{1E58}', "\u{1E59}"), ('\u{1E5A}', "\u{1E5B}"), ('\u{1E5C}', "\u{1E5D}"), ('\u{1E5E}', "\u{1E5F}"), ('\u{1E60}', "\u{1E61}"), ('\u{1E62}', "\u{1E63}"), ('\u{1E64}', "\u{1E65}"), ('\u{1E66}', "\u{1E67}"), ('\u{1E68}', "\u{1E69}"), ('\u{1E6A}', "\u{1E6B}"), ('\u{1E6C}', "\u{1E6D}"), ('\u{1E6E}', "\u{1E6F}"), ('\u{1E70}', "\u{1E71}"), ('\u{1E72}', "\u{1E73}"), ('\u{1E74}', "\u{1E75}"), ('\u{1E76}', "\u{1E77}"), ('\u{1E78}', "\u{1E79}"), ('\u{1E7A}', "\u{1E7B}"), ('\u{1E7C}', "\u{1E7D}"), ('\u{1E7E}', "\u{1E7F}"), ('\u{1E80}', "\u{1E81}"), ('\u{1E82}', "\u{1E83}"), ('\u{1E84}', "\u{1E85}"), ('\u{1E86}', "\u{1E87}"), ('\u{1E88}', "\u{1E89}"), ('\u{1E8A}', "\u{1E8B}"), ('\u{1E8C}', "\u{1E8D}"), ('\u{1E8E}', "\u{1E8F}"), ('\u{1E90}', "\u{1E91}"), ('\u{1E92}', "\u{1E93}"), ('\u{1E94}', "\u{1E95}"), ('\u{1E96}', "\u{0068}\u{0331}"), ('\u{1E97}', "\u{0074}\u{0308}"), ('\u{1E98}', "\u{0077}\u{030A}"), ('\u{1E99}', "\u{0079}\u{030A}"), ('\u{1E9A}', "\u{0061}\u{02BE}"), ('\u{1E9B}', "\u{1E61}"), ('\u{1EA0}', "\u{1EA1}"), ('\u{1EA2}', "\u{1EA3}"), ('\u{1EA4}', "\u{1EA5}"), ('\u{1EA6}', "\u{1EA7}"), ('\u{1EA8}', "\u{1EA9}"), ('\u{1EAA}', "\u{1EAB}"), ('\u{1EAC}', "\u{1EAD}"), ('\u{1EAE}', "\u{1EAF}"), ('\u{1EB0}', "\u{1EB1}"), ('\u{1EB2}', "\u{1EB3}"), ('\u{1EB4}', "\u{1EB5}"), ('\u{1EB6}', "\u{1EB7}"), ('\u{1EB8}', "\u{1EB9}"), ('\u{1EBA}', "\u{1EBB}"), ('\u{1EBC}', "\u{1EBD}"), ('\u{1EBE}', "\u{1EBF}"), ('\u{1EC0}', "\u{1EC1}"), ('\u{1EC2}', "\u{1EC3}"), ('\u{1EC4}', "\u{1EC5}"), ('\u{1EC6}', "\u{1EC7}"), ('\u{1EC8}', "\u{1EC9}"), ('\u{1ECA}', "\u{1ECB}"), ('\u{1ECC}', "\u{1ECD}"), ('\u{1ECE}', "\u{1ECF}"), ('\u{1ED0}', "\u{1ED1}"), ('\u{1ED2}', "\u{1ED3}"), ('\u{1ED4}', "\u{1ED5}"), ('\u{1ED6}', "\u{1ED7}"), ('\u{1ED8}', "\u{1ED9}"), ('\u{1EDA}', "\u{1EDB}"), ('\u{1EDC}', "\u{1EDD}"), ('\u{1EDE}', "\u{1EDF}"), ('\u{1EE0}', "\u{1EE1}"), ('\u{1EE2}', "\u{1EE3}"), ('\u{1EE4}', "\u{1EE5}"), ('\u{1EE6}', "\u{1EE7}"), ('\u{1EE8}', "\u{1EE9}"), ('\u{1EEA}', "\u{1EEB}"), ('\u{1EEC}', "\u{1EED}"), ('\u{1EEE}', "\u{1EEF}"), ('\u{1EF0}', "\u{1EF1}"), ('\u{1EF2}', "\u{1EF3}"), ('\u{1EF4}', "\u{1EF5}"), ('\u{1EF6}', "\u{1EF7}"), ('\u{1EF8}', "\u{1EF9}"), ('\u{1F08}', "\u{1F00}"), ('\u{1F09}', "\u{1F01}"), ('\u{1F0A}', "\u{1F02}"), ('\u{1F0B}', "\u{1F03}"), ('\u{1F0C}', "\u{1F04}"), ('\u{1F0D}', "\u{1F05}"), ('\u{1F0E}', "\u{1F06}"), ('\u{1F0F}', "\u{1F07}"), ('\u{1F18}', "\u{1F10}"), ('\u{1F19}', "\u{1F11}"), ('\u{1F1A}', "\u{1F12}"), ('\u{1F1B}', "\u{1F13}"), ('\u{1F1C}', "\u{1F14}"), ('\u{1F1D}', "\u{1F15}"), ('\u{1F28}', "\u{1F20}"), ('\u{1F29}', "\u{1F21}"), ('\u{1F2A}', "\u{1F22}"), ('\u{1F2B}', "\u{1F23}"), ('\u{1F2C}', "\u{1F24}"), ('\u{1F2D}', "\u{1F25}"), ('\u{1F2E}', "\u{1F26}"), ('\u{1F2F}', "\u{1F27}"), ('\u{1F38}', "\u{1F30}"), ('\u{1F39}', "\u{1F31}"), ('\u{1F3A}', "\u{1F32}"), ('\u{1F3B}', "\u{1F33}"), ('\u{1F3C}', "\u{1F34}"), ('\u{1F3D}', "\u{1F35}"), ('\u{1F3E}', "\u{1F36}"), ('\u{1F3F}', "\u{1F37}"), ('\u{1F48}', "\u{1F40}"), ('\u{1F49}', "\u{1F41}"), ('\u{1F4A}', "\u{1F42}"), ('\u{1F4B}', "\u{1F43}"), ('\u{1F4C}', "\u{1F44}"), ('\u{1F4D}', "\u{1F45}"), ('\u{1F50}', "\u{03C5}\u{0313}"), ('\u{1F52}', "\u{03C5}\u{0313}\u{0300}"), ('\u{1F54}', "\u{03C5}\u{0313}\u{0301}"), ('\u{1F56}', "\u{03C5}\u{0313}\u{0342}"), ('\u{1F59}', "\u{1F51}"), ('\u{1F5B}', "\u{1F53}"), ('\u{1F5D}', "\u{1F55}"), ('\u{1F5F}', "\u{1F57}"), ('\u{1F68}', "\u{1F60}"), ('\u{1F69}', "\u{1F61}"), ('\u{1F6A}', "\u{1F62}"), ('\u{1F6B}', "\u{1F63}"), ('\u{1F6C}', "\u{1F64}"), ('\u{1F6D}', "\u{1F65}"), ('\u{1F6E}', "\u{1F66}"), ('\u{1F6F}', "\u{1F67}"), ('\u{1F80}', "\u{1F00}\u{03B9}"), ('\u{1F81}', "\u{1F01}\u{03B9}"), ('\u{1F82}', "\u{1F02}\u{03B9}"), ('\u{1F83}', "\u{1F03}\u{03B9}"), ('\u{1F84}', "\u{1F04}\u{03B9}"), ('\u{1F85}', "\u{1F05}\u{03B9}"), ('\u{1F86}', "\u{1F06}\u{03B9}"), ('\u{1F87}', "\u{1F07}\u{03B9}"), ('\u{1F88}', "\u{1F00}\u{03B9}"), ('\u{1F89}', "\u{1F01}\u{03B9}"), ('\u{1F8A}', "\u{1F02}\u{03B9}"), ('\u{1F8B}', "\u{1F03}\u{03B9}"), ('\u{1F8C}', "\u{1F04}\u{03B9}"), ('\u{1F8D}', "\u{1F05}\u{03B9}"), ('\u{1F8E}', "\u{1F06}\u{03B9}"), ('\u{1F8F}', "\u{1F07}\u{03B9}"), ('\u{1F90}', "\u{1F20}\u{03B9}"), ('\u{1F91}', "\u{1F21}\u{03B9}"), ('\u{1F92}', "\u{1F22}\u{03B9}"), ('\u{1F93}', "\u{1F23}\u{03B9}"), ('\u{1F94}', "\u{1F24}\u{03B9}"), ('\u{1F95}', "\u{1F25}\u{03B9}"), ('\u{1F96}', "\u{1F26}\u{03B9}"), ('\u{1F97}', "\u{1F27}\u{03B9}"), ('\u{1F98}', "\u{1F20}\u{03B9}"), ('\u{1F99}', "\u{1F21}\u{03B9}"), ('\u{1F9A}', "\u{1F22}\u{03B9}"), ('\u{1F9B}', "\u{1F23}\u{03B9}"), ('\u{1F9C}', "\u{1F24}\u{03B9}"), ('\u{1F9D}', "\u{1F25}\u{03B9}"), ('\u{1F9E}', "\u{1F26}\u{03B9}"), ('\u{1F9F}', "\u{1F27}\u{03B9}"), ('\u{1FA0}', "\u{1F60}\u{03B9}"), ('\u{1FA1}', "\u{1F61}\u{03B9}"), ('\u{1FA2}', "\u{1F62}\u{03B9}"), ('\u{1FA3}', "\u{1F63}\u{03B9}"), ('\u{1FA4}', "\u{1F64}\u{03B9}"), ('\u{1FA5}', "\u{1F65}\u{03B9}"), ('\u{1FA6}', "\u{1F66}\u{03B9}"), ('\u{1FA7}', "\u{1F67}\u{03B9}"), ('\u{1FA8}', "\u{1F60}\u{03B9}"), ('\u{1FA9}', "\u{1F61}\u{03B9}"), ('\u{1FAA}', "\u{1F62}\u{03B9}"), ('\u{1FAB}', "\u{1F63}\u{03B9}"), ('\u{1FAC}', "\u{1F64}\u{03B9}"), ('\u{1FAD}', "\u{1F65}\u{03B9}"), ('\u{1FAE}', "\u{1F66}\u{03B9}"), ('\u{1FAF}', "\u{1F67}\u{03B9}"), ('\u{1FB2}', "\u{1F70}\u{03B9}"), ('\u{1FB3}', "\u{03B1}\u{03B9}"), ('\u{1FB4}', "\u{03AC}\u{03B9}"), ('\u{1FB6}', "\u{03B1}\u{0342}"), ('\u{1FB7}', "\u{03B1}\u{0342}\u{03B9}"), ('\u{1FB8}', "\u{1FB0}"), ('\u{1FB9}', "\u{1FB1}"), ('\u{1FBA}', "\u{1F70}"), ('\u{1FBB}', "\u{1F71}"), ('\u{1FBC}', "\u{03B1}\u{03B9}"), ('\u{1FBE}', "\u{03B9}"), ('\u{1FC2}', "\u{1F74}\u{03B9}"), ('\u{1FC3}', "\u{03B7}\u{03B9}"), ('\u{1FC4}', "\u{03AE}\u{03B9}"), ('\u{1FC6}', "\u{03B7}\u{0342}"), ('\u{1FC7}', "\u{03B7}\u{0342}\u{03B9}"), ('\u{1FC8}', "\u{1F72}"), ('\u{1FC9}', "\u{1F73}"), ('\u{1FCA}', "\u{1F74}"), ('\u{1FCB}', "\u{1F75}"), ('\u{1FCC}', "\u{03B7}\u{03B9}"), ('\u{1FD2}', "\u{03B9}\u{0308}\u{0300}"), ('\u{1FD3}', "\u{03B9}\u{0308}\u{0301}"), ('\u{1FD6}', "\u{03B9}\u{0342}"), ('\u{1FD7}', "\u{03B9}\u{0308}\u{0342}"), ('\u{1FD8}', "\u{1FD0}"), ('\u{1FD9}', "\u{1FD1}"), ('\u{1FDA}', "\u{1F76}"), ('\u{1FDB}', "\u{1F77}"), ('\u{1FE2}', "\u{03C5}\u{0308}\u{0300}"), ('\u{1FE3}', "\u{03C5}\u{0308}\u{0301}"), ('\u{1FE4}', "\u{03C1}\u{0313}"), ('\u{1FE6}', "\u{03C5}\u{0342}"), ('\u{1FE7}', "\u{03C5}\u{0308}\u{0342}"), ('\u{1FE8}', "\u{1FE0}"), ('\u{1FE9}', "\u{1FE1}"), ('\u{1FEA}', "\u{1F7A}"), ('\u{1FEB}', "\u{1F7B}"), ('\u{1FEC}', "\u{1FE5}"), ('\u{1FF2}', "\u{1F7C}\u{03B9}"), ('\u{1FF3}', "\u{03C9}\u{03B9}"), ('\u{1FF4}', "\u{03CE}\u{03B9}"), ('\u{1FF6}', "\u{03C9}\u{0342}"), ('\u{1FF7}', "\u{03C9}\u{0342}\u{03B9}"), ('\u{1FF8}', "\u{1F78}"), ('\u{1FF9}', "\u{1F79}"), ('\u{1FFA}', "\u{1F7C}"), ('\u{1FFB}', "\u{1F7D}"), ('\u{1FFC}', "\u{03C9}\u{03B9}"), ('\u{20A8}', "\u{0072}\u{0073}"), ('\u{2102}', "\u{0063}"), ('\u{2103}', "\u{00B0}\u{0063}"), ('\u{2107}', "\u{025B}"), ('\u{2109}', "\u{00B0}\u{0066}"), ('\u{210B}', "\u{0068}"), ('\u{210C}', "\u{0068}"), ('\u{210D}', "\u{0068}"), ('\u{2110}', "\u{0069}"), ('\u{2111}', "\u{0069}"), ('\u{2112}', "\u{006C}"), ('\u{2115}', "\u{006E}"), ('\u{2116}', "\u{006E}\u{006F}"), ('\u{2119}', "\u{0070}"), ('\u{211A}', "\u{0071}"), ('\u{211B}', "\u{0072}"), ('\u{211C}', "\u{0072}"), ('\u{211D}', "\u{0072}"), ('\u{2120}', "\u{0073}\u{006D}"), ('\u{2121}', "\u{0074}\u{0065}\u{006C}"), ('\u{2122}', "\u{0074}\u{006D}"), ('\u{2124}', "\u{007A}"), ('\u{2126}', "\u{03C9}"), ('\u{2128}', "\u{007A}"), ('\u{212A}', "\u{006B}"), ('\u{212B}', "\u{00E5}"), ('\u{212C}', "\u{0062}"), ('\u{212D}', "\u{0063}"), ('\u{2130}', "\u{0065}"), ('\u{2131}', "\u{0066}"), ('\u{2133}', "\u{006D}"), ('\u{213E}', "\u{03B3}"), ('\u{213F}', "\u{03C0}"), ('\u{2145}', "\u{0064}"), ('\u{2160}', "\u{2170}"), ('\u{2161}', "\u{2171}"), ('\u{2162}', "\u{2172}"), ('\u{2163}', "\u{2173}"), ('\u{2164}', "\u{2174}"), ('\u{2165}', "\u{2175}"), ('\u{2166}', "\u{2176}"), ('\u{2167}', "\u{2177}"), ('\u{2168}', "\u{2178}"), ('\u{2169}', "\u{2179}"), ('\u{216A}', "\u{217A}"), ('\u{216B}', "\u{217B}"), ('\u{216C}', "\u{217C}"), ('\u{216D}', "\u{217D}"), ('\u{216E}', "\u{217E}"), ('\u{216F}', "\u{217F}"), ('\u{24B6}', "\u{24D0}"), ('\u{24B7}', "\u{24D1}"), ('\u{24B8}', "\u{24D2}"), ('\u{24B9}', "\u{24D3}"), ('\u{24BA}', "\u{24D4}"), ('\u{24BB}', "\u{24D5}"), ('\u{24BC}', "\u{24D6}"), ('\u{24BD}', "\u{24D7}"), ('\u{24BE}', "\u{24D8}"), ('\u{24BF}', "\u{24D9}"), ('\u{24C0}', "\u{24DA}"), ('\u{24C1}', "\u{24DB}"), ('\u{24C2}', "\u{24DC}"), ('\u{24C3}', "\u{24DD}"), ('\u{24C4}', "\u{24DE}"), ('\u{24C5}', "\u{24DF}"), ('\u{24C6}', "\u{24E0}"), ('\u{24C7}', "\u{24E1}"), ('\u{24C8}', "\u{24E2}"), ('\u{24C9}', "\u{24E3}"), ('\u{24CA}', "\u{24E4}"), ('\u{24CB}', "\u{24E5}"), ('\u{24CC}', "\u{24E6}"), ('\u{24CD}', "\u{24E7}"), ('\u{24CE}', "\u{24E8}"), ('\u{24CF}', "\u{24E9}"), ('\u{3371}', "\u{0068}\u{0070}\u{0061}"), ('\u{3373}', "\u{0061}\u{0075}"), ('\u{3375}', "\u{006F}\u{0076}"), ('\u{3380}', "\u{0070}\u{0061}"), ('\u{3381}', "\u{006E}\u{0061}"), ('\u{3382}', "\u{03BC}\u{0061}"), ('\u{3383}', "\u{006D}\u{0061}"), ('\u{3384}', "\u{006B}\u{0061}"), ('\u{3385}', "\u{006B}\u{0062}"), ('\u{3386}', "\u{006D}\u{0062}"), ('\u{3387}', "\u{0067}\u{0062}"), ('\u{338A}', "\u{0070}\u{0066}"), ('\u{338B}', "\u{006E}\u{0066}"), ('\u{338C}', "\u{03BC}\u{0066}"), ('\u{3390}', "\u{0068}\u{007A}"), ('\u{3391}', "\u{006B}\u{0068}\u{007A}"), ('\u{3392}', "\u{006D}\u{0068}\u{007A}"), ('\u{3393}', "\u{0067}\u{0068}\u{007A}"), ('\u{3394}', "\u{0074}\u{0068}\u{007A}"), ('\u{33A9}', "\u{0070}\u{0061}"), ('\u{33AA}', "\u{006B}\u{0070}\u{0061}"), ('\u{33AB}', "\u{006D}\u{0070}\u{0061}"), ('\u{33AC}', "\u{0067}\u{0070}\u{0061}"), ('\u{33B4}', "\u{0070}\u{0076}"), ('\u{33B5}', "\u{006E}\u{0076}"), ('\u{33B6}', "\u{03BC}\u{0076}"), ('\u{33B7}', "\u{006D}\u{0076}"), ('\u{33B8}', "\u{006B}\u{0076}"), ('\u{33B9}', "\u{006D}\u{0076}"), ('\u{33BA}', "\u{0070}\u{0077}"), ('\u{33BB}', "\u{006E}\u{0077}"), ('\u{33BC}', "\u{03BC}\u{0077}"), ('\u{33BD}', "\u{006D}\u{0077}"), ('\u{33BE}', "\u{006B}\u{0077}"), ('\u{33BF}', "\u{006D}\u{0077}"), ('\u{33C0}', "\u{006B}\u{03C9}"), ('\u{33C1}', "\u{006D}\u{03C9}"), ('\u{33C3}', "\u{0062}\u{0071}"), ('\u{33C6}', "\u{0063}\u{2215}\u{006B}\u{0067}"), ('\u{33C7}', "\u{0063}\u{006F}\u{002E}"), ('\u{33C8}', "\u{0064}\u{0062}"), ('\u{33C9}', "\u{0067}\u{0079}"), ('\u{33CB}', "\u{0068}\u{0070}"), ('\u{33CD}', "\u{006B}\u{006B}"), ('\u{33CE}', "\u{006B}\u{006D}"), ('\u{33D7}', "\u{0070}\u{0068}"), ('\u{33D9}', "\u{0070}\u{0070}\u{006D}"), ('\u{33DA}', "\u{0070}\u{0072}"), ('\u{33DC}', "\u{0073}\u{0076}"), ('\u{33DD}', "\u{0077}\u{0062}"), ('\u{FB00}', "\u{0066}\u{0066}"), ('\u{FB01}', "\u{0066}\u{0069}"), ('\u{FB02}', "\u{0066}\u{006C}"), ('\u{FB03}', "\u{0066}\u{0066}\u{0069}"), ('\u{FB04}', "\u{0066}\u{0066}\u{006C}"), ('\u{FB05}', "\u{0073}\u{0074}"), ('\u{FB06}', "\u{0073}\u{0074}"), ('\u{FB13}', "\u{0574}\u{0576}"), ('\u{FB14}', "\u{0574}\u{0565}"), ('\u{FB15}', "\u{0574}\u{056B}"), ('\u{FB16}', "\u{057E}\u{0576}"), ('\u{FB17}', "\u{0574}\u{056D}"), ('\u{FF21}', "\u{FF41}"), ('\u{FF22}', "\u{FF42}"), ('\u{FF23}', "\u{FF43}"), ('\u{FF24}', "\u{FF44}"), ('\u{FF25}', "\u{FF45}"), ('\u{FF26}', "\u{FF46}"), ('\u{FF27}', "\u{FF47}"), ('\u{FF28}', "\u{FF48}"), ('\u{FF29}', "\u{FF49}"), ('\u{FF2A}', "\u{FF4A}"), ('\u{FF2B}', "\u{FF4B}"), ('\u{FF2C}', "\u{FF4C}"), ('\u{FF2D}', "\u{FF4D}"), ('\u{FF2E}', "\u{FF4E}"), ('\u{FF2F}', "\u{FF4F}"), ('\u{FF30}', "\u{FF50}"), ('\u{FF31}', "\u{FF51}"), ('\u{FF32}', "\u{FF52}"), ('\u{FF33}', "\u{FF53}"), ('\u{FF34}', "\u{FF54}"), ('\u{FF35}', "\u{FF55}"), ('\u{FF36}', "\u{FF56}"), ('\u{FF37}', "\u{FF57}"), ('\u{FF38}', "\u{FF58}"), ('\u{FF39}', "\u{FF59}"), ('\u{FF3A}', "\u{FF5A}"), ('\u{10400}', "\u{10428}"), ('\u{10401}', "\u{10429}"), ('\u{10402}', "\u{1042A}"), ('\u{10403}', "\u{1042B}"), ('\u{10404}', "\u{1042C}"), ('\u{10405}', "\u{1042D}"), ('\u{10406}', "\u{1042E}"), ('\u{10407}', "\u{1042F}"), ('\u{10408}', "\u{10430}"), ('\u{10409}', "\u{10431}"), ('\u{1040A}', "\u{10432}"), ('\u{1040B}', "\u{10433}"), ('\u{1040C}', "\u{10434}"), ('\u{1040D}', "\u{10435}"), ('\u{1040E}', "\u{10436}"), ('\u{1040F}', "\u{10437}"), ('\u{10410}', "\u{10438}"), ('\u{10411}', "\u{10439}"), ('\u{10412}', "\u{1043A}"), ('\u{10413}', "\u{1043B}"), ('\u{10414}', "\u{1043C}"), ('\u{10415}', "\u{1043D}"), ('\u{10416}', "\u{1043E}"), ('\u{10417}', "\u{1043F}"), ('\u{10418}', "\u{10440}"), ('\u{10419}', "\u{10441}"), ('\u{1041A}', "\u{10442}"), ('\u{1041B}', "\u{10443}"), ('\u{1041C}', "\u{10444}"), ('\u{1041D}', "\u{10445}"), ('\u{1041E}', "\u{10446}"), ('\u{1041F}', "\u{10447}"), ('\u{10420}', "\u{10448}"), ('\u{10421}', "\u{10449}"), ('\u{10422}', "\u{1044A}"), ('\u{10423}', "\u{1044B}"), ('\u{10424}', "\u{1044C}"), ('\u{10425}', "\u{1044D}"), ('\u{1D400}', "\u{0061}"), ('\u{1D401}', "\u{0062}"), ('\u{1D402}', "\u{0063}"), ('\u{1D403}', "\u{0064}"), ('\u{1D404}', "\u{0065}"), ('\u{1D405}', "\u{0066}"), ('\u{1D406}', "\u{0067}"), ('\u{1D407}', "\u{0068}"), ('\u{1D408}', "\u{0069}"), ('\u{1D409}', "\u{006A}"), ('\u{1D40A}', "\u{006B}"), ('\u{1D40B}', "\u{006C}"), ('\u{1D40C}', "\u{006D}"), ('\u{1D40D}', "\u{006E}"), ('\u{1D40E}', "\u{006F}"), ('\u{1D40F}', "\u{0070}"), ('\u{1D410}', "\u{0071}"), ('\u{1D411}', "\u{0072}"), ('\u{1D412}', "\u{0073}"), ('\u{1D413}', "\u{0074}"), ('\u{1D414}', "\u{0075}"), ('\u{1D415}', "\u{0076}"), ('\u{1D416}', "\u{0077}"), ('\u{1D417}', "\u{0078}"), ('\u{1D418}', "\u{0079}"), ('\u{1D419}', "\u{007A}"), ('\u{1D434}', "\u{0061}"), ('\u{1D435}', "\u{0062}"), ('\u{1D436}', "\u{0063}"), ('\u{1D437}', "\u{0064}"), ('\u{1D438}', "\u{0065}"), ('\u{1D439}', "\u{0066}"), ('\u{1D43A}', "\u{0067}"), ('\u{1D43B}', "\u{0068}"), ('\u{1D43C}', "\u{0069}"), ('\u{1D43D}', "\u{006A}"), ('\u{1D43E}', "\u{006B}"), ('\u{1D43F}', "\u{006C}"), ('\u{1D440}', "\u{006D}"), ('\u{1D441}', "\u{006E}"), ('\u{1D442}', "\u{006F}"), ('\u{1D443}', "\u{0070}"), ('\u{1D444}', "\u{0071}"), ('\u{1D445}', "\u{0072}"), ('\u{1D446}', "\u{0073}"), ('\u{1D447}', "\u{0074}"), ('\u{1D448}', "\u{0075}"), ('\u{1D449}', "\u{0076}"), ('\u{1D44A}', "\u{0077}"), ('\u{1D44B}', "\u{0078}"), ('\u{1D44C}', "\u{0079}"), ('\u{1D44D}', "\u{007A}"), ('\u{1D468}', "\u{0061}"), ('\u{1D469}', "\u{0062}"), ('\u{1D46A}', "\u{0063}"), ('\u{1D46B}', "\u{0064}"), ('\u{1D46C}', "\u{0065}"), ('\u{1D46D}', "\u{0066}"), ('\u{1D46E}', "\u{0067}"), ('\u{1D46F}', "\u{0068}"), ('\u{1D470}', "\u{0069}"), ('\u{1D471}', "\u{006A}"), ('\u{1D472}', "\u{006B}"), ('\u{1D473}', "\u{006C}"), ('\u{1D474}', "\u{006D}"), ('\u{1D475}', "\u{006E}"), ('\u{1D476}', "\u{006F}"), ('\u{1D477}', "\u{0070}"), ('\u{1D478}', "\u{0071}"), ('\u{1D479}', "\u{0072}"), ('\u{1D47A}', "\u{0073}"), ('\u{1D47B}', "\u{0074}"), ('\u{1D47C}', "\u{0075}"), ('\u{1D47D}', "\u{0076}"), ('\u{1D47E}', "\u{0077}"), ('\u{1D47F}', "\u{0078}"), ('\u{1D480}', "\u{0079}"), ('\u{1D481}', "\u{007A}"), ('\u{1D49C}', "\u{0061}"), ('\u{1D49E}', "\u{0063}"), ('\u{1D49F}', "\u{0064}"), ('\u{1D4A2}', "\u{0067}"), ('\u{1D4A5}', "\u{006A}"), ('\u{1D4A6}', "\u{006B}"), ('\u{1D4A9}', "\u{006E}"), ('\u{1D4AA}', "\u{006F}"), ('\u{1D4AB}', "\u{0070}"), ('\u{1D4AC}', "\u{0071}"), ('\u{1D4AE}', "\u{0073}"), ('\u{1D4AF}', "\u{0074}"), ('\u{1D4B0}', "\u{0075}"), ('\u{1D4B1}', "\u{0076}"), ('\u{1D4B2}', "\u{0077}"), ('\u{1D4B3}', "\u{0078}"), ('\u{1D4B4}', "\u{0079}"), ('\u{1D4B5}', "\u{007A}"), ('\u{1D4D0}', "\u{0061}"), ('\u{1D4D1}', "\u{0062}"), ('\u{1D4D2}', "\u{0063}"), ('\u{1D4D3}', "\u{0064}"), ('\u{1D4D4}', "\u{0065}"), ('\u{1D4D5}', "\u{0066}"), ('\u{1D4D6}', "\u{0067}"), ('\u{1D4D7}', "\u{0068}"), ('\u{1D4D8}', "\u{0069}"), ('\u{1D4D9}', "\u{006A}"), ('\u{1D4DA}', "\u{006B}"), ('\u{1D4DB}', "\u{006C}"), ('\u{1D4DC}', "\u{006D}"), ('\u{1D4DD}', "\u{006E}"), ('\u{1D4DE}', "\u{006F}"), ('\u{1D4DF}', "\u{0070}"), ('\u{1D4E0}', "\u{0071}"), ('\u{1D4E1}', "\u{0072}"), ('\u{1D4E2}', "\u{0073}"), ('\u{1D4E3}', "\u{0074}"), ('\u{1D4E4}', "\u{0075}"), ('\u{1D4E5}', "\u{0076}"), ('\u{1D4E6}', "\u{0077}"), ('\u{1D4E7}', "\u{0078}"), ('\u{1D4E8}', "\u{0079}"), ('\u{1D4E9}', "\u{007A}"), ('\u{1D504}', "\u{0061}"), ('\u{1D505}', "\u{0062}"), ('\u{1D507}', "\u{0064}"), ('\u{1D508}', "\u{0065}"), ('\u{1D509}', "\u{0066}"), ('\u{1D50A}', "\u{0067}"), ('\u{1D50D}', "\u{006A}"), ('\u{1D50E}', "\u{006B}"), ('\u{1D50F}', "\u{006C}"), ('\u{1D510}', "\u{006D}"), ('\u{1D511}', "\u{006E}"), ('\u{1D512}', "\u{006F}"), ('\u{1D513}', "\u{0070}"), ('\u{1D514}', "\u{0071}"), ('\u{1D516}', "\u{0073}"), ('\u{1D517}', "\u{0074}"), ('\u{1D518}', "\u{0075}"), ('\u{1D519}', "\u{0076}"), ('\u{1D51A}', "\u{0077}"), ('\u{1D51B}', "\u{0078}"), ('\u{1D51C}', "\u{0079}"), ('\u{1D538}', "\u{0061}"), ('\u{1D539}', "\u{0062}"), ('\u{1D53B}', "\u{0064}"), ('\u{1D53C}', "\u{0065}"), ('\u{1D53D}', "\u{0066}"), ('\u{1D53E}', "\u{0067}"), ('\u{1D540}', "\u{0069}"), ('\u{1D541}', "\u{006A}"), ('\u{1D542}', "\u{006B}"), ('\u{1D543}', "\u{006C}"), ('\u{1D544}', "\u{006D}"), ('\u{1D546}', "\u{006F}"), ('\u{1D54A}', "\u{0073}"), ('\u{1D54B}', "\u{0074}"), ('\u{1D54C}', "\u{0075}"), ('\u{1D54D}', "\u{0076}"), ('\u{1D54E}', "\u{0077}"), ('\u{1D54F}', "\u{0078}"), ('\u{1D550}', "\u{0079}"), ('\u{1D56C}', "\u{0061}"), ('\u{1D56D}', "\u{0062}"), ('\u{1D56E}', "\u{0063}"), ('\u{1D56F}', "\u{0064}"), ('\u{1D570}', "\u{0065}"), ('\u{1D571}', "\u{0066}"), ('\u{1D572}', "\u{0067}"), ('\u{1D573}', "\u{0068}"), ('\u{1D574}', "\u{0069}"), ('\u{1D575}', "\u{006A}"), ('\u{1D576}', "\u{006B}"), ('\u{1D577}', "\u{006C}"), ('\u{1D578}', "\u{006D}"), ('\u{1D579}', "\u{006E}"), ('\u{1D57A}', "\u{006F}"), ('\u{1D57B}', "\u{0070}"), ('\u{1D57C}', "\u{0071}"), ('\u{1D57D}', "\u{0072}"), ('\u{1D57E}', "\u{0073}"), ('\u{1D57F}', "\u{0074}"), ('\u{1D580}', "\u{0075}"), ('\u{1D581}', "\u{0076}"), ('\u{1D582}', "\u{0077}"), ('\u{1D583}', "\u{0078}"), ('\u{1D584}', "\u{0079}"), ('\u{1D585}', "\u{007A}"), ('\u{1D5A0}', "\u{0061}"), ('\u{1D5A1}', "\u{0062}"), ('\u{1D5A2}', "\u{0063}"), ('\u{1D5A3}', "\u{0064}"), ('\u{1D5A4}', "\u{0065}"), ('\u{1D5A5}', "\u{0066}"), ('\u{1D5A6}', "\u{0067}"), ('\u{1D5A7}', "\u{0068}"), ('\u{1D5A8}', "\u{0069}"), ('\u{1D5A9}', "\u{006A}"), ('\u{1D5AA}', "\u{006B}"), ('\u{1D5AB}', "\u{006C}"), ('\u{1D5AC}', "\u{006D}"), ('\u{1D5AD}', "\u{006E}"), ('\u{1D5AE}', "\u{006F}"), ('\u{1D5AF}', "\u{0070}"), ('\u{1D5B0}', "\u{0071}"), ('\u{1D5B1}', "\u{0072}"), ('\u{1D5B2}', "\u{0073}"), ('\u{1D5B3}', "\u{0074}"), ('\u{1D5B4}', "\u{0075}"), ('\u{1D5B5}', "\u{0076}"), ('\u{1D5B6}', "\u{0077}"), ('\u{1D5B7}', "\u{0078}"), ('\u{1D5B8}', "\u{0079}"), ('\u{1D5B9}', "\u{007A}"), ('\u{1D5D4}', "\u{0061}"), ('\u{1D5D5}', "\u{0062}"), ('\u{1D5D6}', "\u{0063}"), ('\u{1D5D7}', "\u{0064}"), ('\u{1D5D8}', "\u{0065}"), ('\u{1D5D9}', "\u{0066}"), ('\u{1D5DA}', "\u{0067}"), ('\u{1D5DB}', "\u{0068}"), ('\u{1D5DC}', "\u{0069}"), ('\u{1D5DD}', "\u{006A}"), ('\u{1D5DE}', "\u{006B}"), ('\u{1D5DF}', "\u{006C}"), ('\u{1D5E0}', "\u{006D}"), ('\u{1D5E1}', "\u{006E}"), ('\u{1D5E2}', "\u{006F}"), ('\u{1D5E3}', "\u{0070}"), ('\u{1D5E4}', "\u{0071}"), ('\u{1D5E5}', "\u{0072}"), ('\u{1D5E6}', "\u{0073}"), ('\u{1D5E7}', "\u{0074}"), ('\u{1D5E8}', "\u{0075}"), ('\u{1D5E9}', "\u{0076}"), ('\u{1D5EA}', "\u{0077}"), ('\u{1D5EB}', "\u{0078}"), ('\u{1D5EC}', "\u{0079}"), ('\u{1D5ED}', "\u{007A}"), ('\u{1D608}', "\u{0061}"), ('\u{1D609}', "\u{0062}"), ('\u{1D60A}', "\u{0063}"), ('\u{1D60B}', "\u{0064}"), ('\u{1D60C}', "\u{0065}"), ('\u{1D60D}', "\u{0066}"), ('\u{1D60E}', "\u{0067}"), ('\u{1D60F}', "\u{0068}"), ('\u{1D610}', "\u{0069}"), ('\u{1D611}', "\u{006A}"), ('\u{1D612}', "\u{006B}"), ('\u{1D613}', "\u{006C}"), ('\u{1D614}', "\u{006D}"), ('\u{1D615}', "\u{006E}"), ('\u{1D616}', "\u{006F}"), ('\u{1D617}', "\u{0070}"), ('\u{1D618}', "\u{0071}"), ('\u{1D619}', "\u{0072}"), ('\u{1D61A}', "\u{0073}"), ('\u{1D61B}', "\u{0074}"), ('\u{1D61C}', "\u{0075}"), ('\u{1D61D}', "\u{0076}"), ('\u{1D61E}', "\u{0077}"), ('\u{1D61F}', "\u{0078}"), ('\u{1D620}', "\u{0079}"), ('\u{1D621}', "\u{007A}"), ('\u{1D63C}', "\u{0061}"), ('\u{1D63D}', "\u{0062}"), ('\u{1D63E}', "\u{0063}"), ('\u{1D63F}', "\u{0064}"), ('\u{1D640}', "\u{0065}"), ('\u{1D641}', "\u{0066}"), ('\u{1D642}', "\u{0067}"), ('\u{1D643}', "\u{0068}"), ('\u{1D644}', "\u{0069}"), ('\u{1D645}', "\u{006A}"), ('\u{1D646}', "\u{006B}"), ('\u{1D647}', "\u{006C}"), ('\u{1D648}', "\u{006D}"), ('\u{1D649}', "\u{006E}"), ('\u{1D64A}', "\u{006F}"), ('\u{1D64B}', "\u{0070}"), ('\u{1D64C}', "\u{0071}"), ('\u{1D64D}', "\u{0072}"), ('\u{1D64E}', "\u{0073}"), ('\u{1D64F}', "\u{0074}"), ('\u{1D650}', "\u{0075}"), ('\u{1D651}', "\u{0076}"), ('\u{1D652}', "\u{0077}"), ('\u{1D653}', "\u{0078}"), ('\u{1D654}', "\u{0079}"), ('\u{1D655}', "\u{007A}"), ('\u{1D670}', "\u{0061}"), ('\u{1D671}', "\u{0062}"), ('\u{1D672}', "\u{0063}"), ('\u{1D673}', "\u{0064}"), ('\u{1D674}', "\u{0065}"), ('\u{1D675}', "\u{0066}"), ('\u{1D676}', "\u{0067}"), ('\u{1D677}', "\u{0068}"), ('\u{1D678}', "\u{0069}"), ('\u{1D679}', "\u{006A}"), ('\u{1D67A}', "\u{006B}"), ('\u{1D67B}', "\u{006C}"), ('\u{1D67C}', "\u{006D}"), ('\u{1D67D}', "\u{006E}"), ('\u{1D67E}', "\u{006F}"), ('\u{1D67F}', "\u{0070}"), ('\u{1D680}', "\u{0071}"), ('\u{1D681}', "\u{0072}"), ('\u{1D682}', "\u{0073}"), ('\u{1D683}', "\u{0074}"), ('\u{1D684}', "\u{0075}"), ('\u{1D685}', "\u{0076}"), ('\u{1D686}', "\u{0077}"), ('\u{1D687}', "\u{0078}"), ('\u{1D688}', "\u{0079}"), ('\u{1D689}', "\u{007A}"), ('\u{1D6A8}', "\u{03B1}"), ('\u{1D6A9}', "\u{03B2}"), ('\u{1D6AA}', "\u{03B3}"), ('\u{1D6AB}', "\u{03B4}"), ('\u{1D6AC}', "\u{03B5}"), ('\u{1D6AD}', "\u{03B6}"), ('\u{1D6AE}', "\u{03B7}"), ('\u{1D6AF}', "\u{03B8}"), ('\u{1D6B0}', "\u{03B9}"), ('\u{1D6B1}', "\u{03BA}"), ('\u{1D6B2}', "\u{03BB}"), ('\u{1D6B3}', "\u{03BC}"), ('\u{1D6B4}', "\u{03BD}"), ('\u{1D6B5}', "\u{03BE}"), ('\u{1D6B6}', "\u{03BF}"), ('\u{1D6B7}', "\u{03C0}"), ('\u{1D6B8}', "\u{03C1}"), ('\u{1D6B9}', "\u{03B8}"), ('\u{1D6BA}', "\u{03C3}"), ('\u{1D6BB}', "\u{03C4}"), ('\u{1D6BC}', "\u{03C5}"), ('\u{1D6BD}', "\u{03C6}"), ('\u{1D6BE}', "\u{03C7}"), ('\u{1D6BF}', "\u{03C8}"), ('\u{1D6C0}', "\u{03C9}"), ('\u{1D6D3}', "\u{03C3}"), ('\u{1D6E2}', "\u{03B1}"), ('\u{1D6E3}', "\u{03B2}"), ('\u{1D6E4}', "\u{03B3}"), ('\u{1D6E5}', "\u{03B4}"), ('\u{1D6E6}', "\u{03B5}"), ('\u{1D6E7}', "\u{03B6}"), ('\u{1D6E8}', "\u{03B7}"), ('\u{1D6E9}', "\u{03B8}"), ('\u{1D6EA}', "\u{03B9}"), ('\u{1D6EB}', "\u{03BA}"), ('\u{1D6EC}', "\u{03BB}"), ('\u{1D6ED}', "\u{03BC}"), ('\u{1D6EE}', "\u{03BD}"), ('\u{1D6EF}', "\u{03BE}"), ('\u{1D6F0}', "\u{03BF}"), ('\u{1D6F1}', "\u{03C0}"), ('\u{1D6F2}', "\u{03C1}"), ('\u{1D6F3}', "\u{03B8}"), ('\u{1D6F4}', "\u{03C3}"), ('\u{1D6F5}', "\u{03C4}"), ('\u{1D6F6}', "\u{03C5}"), ('\u{1D6F7}', "\u{03C6}"), ('\u{1D6F8}', "\u{03C7}"), ('\u{1D6F9}', "\u{03C8}"), ('\u{1D6FA}', "\u{03C9}"), ('\u{1D70D}', "\u{03C3}"), ('\u{1D71C}', "\u{03B1}"), ('\u{1D71D}', "\u{03B2}"), ('\u{1D71E}', "\u{03B3}"), ('\u{1D71F}', "\u{03B4}"), ('\u{1D720}', "\u{03B5}"), ('\u{1D721}', "\u{03B6}"), ('\u{1D722}', "\u{03B7}"), ('\u{1D723}', "\u{03B8}"), ('\u{1D724}', "\u{03B9}"), ('\u{1D725}', "\u{03BA}"), ('\u{1D726}', "\u{03BB}"), ('\u{1D727}', "\u{03BC}"), ('\u{1D728}', "\u{03BD}"), ('\u{1D729}', "\u{03BE}"), ('\u{1D72A}', "\u{03BF}"), ('\u{1D72B}', "\u{03C0}"), ('\u{1D72C}', "\u{03C1}"), ('\u{1D72D}', "\u{03B8}"), ('\u{1D72E}', "\u{03C3}"), ('\u{1D72F}', "\u{03C4}"), ('\u{1D730}', "\u{03C5}"), ('\u{1D731}', "\u{03C6}"), ('\u{1D732}', "\u{03C7}"), ('\u{1D733}', "\u{03C8}"), ('\u{1D734}', "\u{03C9}"), ('\u{1D747}', "\u{03C3}"), ('\u{1D756}', "\u{03B1}"), ('\u{1D757}', "\u{03B2}"), ('\u{1D758}', "\u{03B3}"), ('\u{1D759}', "\u{03B4}"), ('\u{1D75A}', "\u{03B5}"), ('\u{1D75B}', "\u{03B6}"), ('\u{1D75C}', "\u{03B7}"), ('\u{1D75D}', "\u{03B8}"), ('\u{1D75E}', "\u{03B9}"), ('\u{1D75F}', "\u{03BA}"), ('\u{1D760}', "\u{03BB}"), ('\u{1D761}', "\u{03BC}"), ('\u{1D762}', "\u{03BD}"), ('\u{1D763}', "\u{03BE}"), ('\u{1D764}', "\u{03BF}"), ('\u{1D765}', "\u{03C0}"), ('\u{1D766}', "\u{03C1}"), ('\u{1D767}', "\u{03B8}"), ('\u{1D768}', "\u{03C3}"), ('\u{1D769}', "\u{03C4}"), ('\u{1D76A}', "\u{03C5}"), ('\u{1D76B}', "\u{03C6}"), ('\u{1D76C}', "\u{03C7}"), ('\u{1D76D}', "\u{03C8}"), ('\u{1D76E}', "\u{03C9}"), ('\u{1D781}', "\u{03C3}"), ('\u{1D790}', "\u{03B1}"), ('\u{1D791}', "\u{03B2}"), ('\u{1D792}', "\u{03B3}"), ('\u{1D793}', "\u{03B4}"), ('\u{1D794}', "\u{03B5}"), ('\u{1D795}', "\u{03B6}"), ('\u{1D796}', "\u{03B7}"), ('\u{1D797}', "\u{03B8}"), ('\u{1D798}', "\u{03B9}"), ('\u{1D799}', "\u{03BA}"), ('\u{1D79A}', "\u{03BB}"), ('\u{1D79B}', "\u{03BC}"), ('\u{1D79C}', "\u{03BD}"), ('\u{1D79D}', "\u{03BE}"), ('\u{1D79E}', "\u{03BF}"), ('\u{1D79F}', "\u{03C0}"), ('\u{1D7A0}', "\u{03C1}"), ('\u{1D7A1}', "\u{03B8}"), ('\u{1D7A2}', "\u{03C3}"), ('\u{1D7A3}', "\u{03C4}"), ('\u{1D7A4}', "\u{03C5}"), ('\u{1D7A5}', "\u{03C6}"), ('\u{1D7A6}', "\u{03C7}"), ('\u{1D7A7}', "\u{03C8}"), ('\u{1D7A8}', "\u{03C9}"), ('\u{1D7BB}', "\u{03C3}"), ]; stringprep-0.1.5/src/tables.rs000064400000000000000000000151461046102023000144420ustar 00000000000000//! Character Tables use std::cmp::Ordering; use std::str::Chars; use unicode_bidi::{bidi_class, BidiClass}; use unicode_properties::{GeneralCategoryGroup, UnicodeGeneralCategory}; use super::rfc3454; /// A.1 Unassigned code points in Unicode 3.2 pub fn unassigned_code_point(c: char) -> bool { rfc3454::A_1 .binary_search_by(|&(start, end)| { if start > c { Ordering::Greater } else if end < c { Ordering::Less } else { Ordering::Equal } }) .is_ok() } /// B.1 Commonly mapped to nothing pub fn commonly_mapped_to_nothing(c: char) -> bool { matches!( c, '\u{00AD}' | '\u{034F}' | '\u{1806}' | '\u{180B}' | '\u{180C}' | '\u{180D}' | '\u{200B}' | '\u{200C}' | '\u{200D}' | '\u{2060}' | '\u{FE00}' | '\u{FE01}' | '\u{FE02}' | '\u{FE03}' | '\u{FE04}' | '\u{FE05}' | '\u{FE06}' | '\u{FE07}' | '\u{FE08}' | '\u{FE09}' | '\u{FE0A}' | '\u{FE0B}' | '\u{FE0C}' | '\u{FE0D}' | '\u{FE0E}' | '\u{FE0F}' | '\u{FEFF}' ) } /// B.2 Mapping for case-folding used with NFKC. pub fn case_fold_for_nfkc(c: char) -> CaseFoldForNfkc { let inner = match rfc3454::B_2.binary_search_by_key(&c, |e| e.0) { Ok(idx) => FoldInner::Chars(rfc3454::B_2[idx].1.chars()), Err(_) => FoldInner::Char(Some(c)), }; CaseFoldForNfkc(inner) } enum FoldInner { Chars(Chars<'static>), Char(Option), } /// The iterator returned by `case_fold_for_nfkc`. pub struct CaseFoldForNfkc(FoldInner); impl Iterator for CaseFoldForNfkc { type Item = char; fn next(&mut self) -> Option { match self.0 { FoldInner::Chars(ref mut it) => it.next(), FoldInner::Char(ref mut ch) => ch.take(), } } } /// C.1.1 ASCII space characters pub fn ascii_space_character(c: char) -> bool { c == ' ' } /// C.1.2 Non-ASCII space characters pub fn non_ascii_space_character(c: char) -> bool { matches!( c, '\u{00A0}' | '\u{1680}' | '\u{2000}' | '\u{2001}' | '\u{2002}' | '\u{2003}' | '\u{2004}' | '\u{2005}' | '\u{2006}' | '\u{2007}' | '\u{2008}' | '\u{2009}' | '\u{200A}' | '\u{200B}' | '\u{202F}' | '\u{205F}' | '\u{3000}' ) } /// C.2.1 ASCII control characters pub fn ascii_control_character(c: char) -> bool { matches!(c, '\u{0000}'..='\u{001F}' | '\u{007F}') } /// C.2.2 Non-ASCII control characters pub fn non_ascii_control_character(c: char) -> bool { matches!(c, '\u{0080}'..='\u{009F}' | '\u{06DD}' | '\u{070F}' | '\u{180E}' | '\u{200C}' | '\u{200D}' | '\u{2028}' | '\u{2029}' | '\u{2060}' | '\u{2061}' | '\u{2062}' | '\u{2063}' | '\u{206A}'..='\u{206F}' | '\u{FEFF}' | '\u{FFF9}'..='\u{FFFC}' | '\u{1D173}'..='\u{1D17A}') } /// C.3 Private use pub fn private_use(c: char) -> bool { matches!(c, '\u{E000}'..='\u{F8FF}' | '\u{F0000}'..='\u{FFFFD}' | '\u{100000}'..='\u{10FFFD}') } /// C.4 Non-character code points pub fn non_character_code_point(c: char) -> bool { matches!(c, '\u{FDD0}'..='\u{FDEF}' | '\u{FFFE}'..='\u{FFFF}' | '\u{1FFFE}'..='\u{1FFFF}' | '\u{2FFFE}'..='\u{2FFFF}' | '\u{3FFFE}'..='\u{3FFFF}' | '\u{4FFFE}'..='\u{4FFFF}' | '\u{5FFFE}'..='\u{5FFFF}' | '\u{6FFFE}'..='\u{6FFFF}' | '\u{7FFFE}'..='\u{7FFFF}' | '\u{8FFFE}'..='\u{8FFFF}' | '\u{9FFFE}'..='\u{9FFFF}' | '\u{AFFFE}'..='\u{AFFFF}' | '\u{BFFFE}'..='\u{BFFFF}' | '\u{CFFFE}'..='\u{CFFFF}' | '\u{DFFFE}'..='\u{DFFFF}' | '\u{EFFFE}'..='\u{EFFFF}' | '\u{FFFFE}'..='\u{FFFFF}' | '\u{10FFFE}'..='\u{10FFFF}') } /// C.5 Surrogate codes #[allow(clippy::match_single_binding)] pub fn surrogate_code(c: char) -> bool { match c { // forbidden by rust /*'\u{D800}'..='\u{DFFF}' => true,*/ _ => false, } } /// C.6 Inappropriate for plain text pub fn inappropriate_for_plain_text(c: char) -> bool { matches!( c, '\u{FFF9}' | '\u{FFFA}' | '\u{FFFB}' | '\u{FFFC}' | '\u{FFFD}' ) } /// C.7 Inappropriate for canonical representation pub fn inappropriate_for_canonical_representation(c: char) -> bool { matches!(c, '\u{2FF0}'..='\u{2FFB}') } /// C.8 Change display properties or are deprecated pub fn change_display_properties_or_deprecated(c: char) -> bool { matches!( c, '\u{0340}' | '\u{0341}' | '\u{200E}' | '\u{200F}' | '\u{202A}' | '\u{202B}' | '\u{202C}' | '\u{202D}' | '\u{202E}' | '\u{206A}' | '\u{206B}' | '\u{206C}' | '\u{206D}' | '\u{206E}' | '\u{206F}' ) } /// C.9 Tagging characters pub fn tagging_character(c: char) -> bool { matches!(c, '\u{E0001}' | '\u{E0020}'..='\u{E007F}') } /// D.1 Characters with bidirectional property "R" or "AL" pub fn bidi_r_or_al(c: char) -> bool { matches!(bidi_class(c), BidiClass::R | BidiClass::AL) } /// D.2 Characters with bidirectional property "L" pub fn bidi_l(c: char) -> bool { matches!(bidi_class(c), BidiClass::L) } /// Determines if `c` is to be removed according to section 7.2 of /// [ITU-T Recommendation X.520 (2019)](https://www.itu.int/rec/T-REC-X.520-201910-I/en). pub fn x520_mapped_to_nothing(c: char) -> bool { match c { '\u{00AD}' | '\u{1806}' | '\u{034F}' | '\u{180B}'..='\u{180D}' | '\u{FE00}'..='\u{FE0F}' | '\u{FFFC}' | '\u{200B}' => true, // Technically control characters, but mapped to whitespace in X.520. '\u{09}' | '\u{0A}'..='\u{0D}' | '\u{85}' => false, _ => c.is_control(), } } /// Determines if `c` is to be replaced by SPACE (0x20) according to section 7.2 of /// [ITU-T Recommendation X.520 (2019)](https://www.itu.int/rec/T-REC-X.520-201910-I/en). pub fn x520_mapped_to_space(c: char) -> bool { match c { '\u{09}' | '\u{0A}'..='\u{0D}' | '\u{85}' => true, _ => c.general_category_group() == GeneralCategoryGroup::Separator, } } stringprep-0.1.5/tests/nameprep_tests.rs000064400000000000000000000222271046102023000165720ustar 00000000000000// Integration tests from https://tools.ietf.org/html/draft-josefsson-idn-test-vectors-00 extern crate stringprep; use stringprep::{nameprep, Error}; fn assert_prohibited_character(result: Result) { assert!(result.is_err()); } fn assert_prohibited_bidirectional_text(result: Result) { assert!(result.is_err()); } // Additional examples from http://josefsson.org/idn.php #[test] fn test_nameprep() { assert_eq!( "安室奈美恵-with-super-monkeys", nameprep("安室奈美恵-with-SUPER-MONKEYS").unwrap() ); assert_eq!("미술", nameprep("미술").unwrap()); // Korean assert_eq!("ليهمابتكلموشعربي؟", nameprep("ليهمابتكلموشعربي؟").unwrap()); // Egyptian assert_eq!( "他们为什么不说中文", nameprep("他们为什么不说中文").unwrap() ); // Chinese assert_eq!( "למההםפשוטלאמדבריםעברית", nameprep("למההםפשוטלאמדבריםעברית").unwrap() ); // Hebrew assert_eq!( "почемужеонинеговорятпорусски", nameprep("почемужеонинеговорятпорусски").unwrap() ); // Russian assert_eq!( "tạisaohọkhôngthểchỉnóitiếngviệt", nameprep("TạisaohọkhôngthểchỉnóitiếngViệt").unwrap() ); // Vietnamese assert_eq!("ひとつ屋根の下2", nameprep("ひとつ屋根の下2").unwrap()); // Japanese assert_eq!( "pročprostěnemluvíčesky", nameprep("Pročprostěnemluvíčesky").unwrap() ); // Czech assert_eq!( "यहलोगहिन्दीक्योंनहींबोलसकतेहैं", nameprep("यहलोगहिन्दीक्योंनहींबोलसकतेहैं").unwrap() ); // Hindi assert_eq!("ພາສາລາວ", nameprep("ພາສາລາວ").unwrap()); // Lao assert_eq!("bonġusaħħa", nameprep("bonġusaħħa").unwrap()); // Maltese assert_eq!("ελληνικά", nameprep("ελληνικά").unwrap()); // Greek } // 4.1 Map to nothing #[test] fn should_map_to_nothing() { let input = "foo\u{00ad}\u{034f}\u{1806}\u{180b}bar\u{200b}\u{2060}baz\u{fe00}\u{fe08}\u{fe0f}\u{feff}"; assert_eq!("foobarbaz", nameprep(input).unwrap()); } // 4.2 Case folding ASCII U+0043 U+0041 U+0046 U+0045 #[test] fn should_case_fold_ascii() { assert_eq!("cafe", nameprep("CAFE").unwrap()); } // 4.3 Case folding 8bit U+00DF (german sharp s) #[test] fn should_case_fold_8bit() { assert_eq!("ss", nameprep("\u{00df}").unwrap()); } // 4.4 Case folding U+0130 (turkish capital I with dot) #[test] fn should_case_fold_16bit() { assert_eq!("\u{0069}\u{0307}", nameprep("\u{0130}").unwrap()); } // 4.5 Case folding multibyte U+0143 U+037A #[test] fn should_case_fold_multibyte() { let input = "\u{0143}\u{037a}"; let output = "\u{0144} \u{03b9}"; assert_eq!(output, nameprep(input).unwrap()); } // 4.6 Case folding U+2121 U+33C6 U+1D7BB #[test] fn should_case_fold() { let input = "\u{2121}\u{33c6}\u{1d7bb}"; let output = "telc\u{2215}\u{006b}\u{0067}\u{03c3}"; assert_eq!(output, nameprep(input).unwrap()); } // 4.7 Normalization of U+006a U+030c U+00A0 U+00AA #[test] fn should_normalize() { let input = "j\u{030c}\u{00a0}\u{00aa}"; let output = "\u{01f0} a"; assert_eq!(output, nameprep(input).unwrap()); } // 4.8 Case folding U+1FB7 and normalization #[test] fn should_case_fold_and_normalize() { let input = "\u{1fb7}"; let output = "\u{1fb6}\u{03b9}"; assert_eq!(output, nameprep(input).unwrap()); } // 4.9 Self-reverting case folding U+01F0 and normalization // 4.10 Self-reverting case folding U+0390 and normalization // 4.11 Self-reverting case folding U+03B0 and normalization // 4.12 Self-reverting case folding U+1E96 and normalization // 4.13 Self-reverting case folding U+1F56 and normalization #[test] fn should_revert_case_fold_and_normalization() { let inputs = ["\u{01f0}", "\u{0390}", "\u{03b0}", "\u{1e96}", "\u{1f56}"]; for input in inputs.iter() { assert_eq!(*input, nameprep(input).unwrap()); } } // 4.14 ASCII space character U+0020 #[test] fn should_permit_ascii_space() { assert_eq!(" ", nameprep(" ").unwrap()); } // 4.15 Non-ASCII 8bit space character U+00A0 #[test] fn should_map_8bit_space() { assert_eq!(" ", nameprep("\u{00a0}").unwrap()); } // 4.16 Non-ASCII multibyte space character U+1680 #[test] fn should_prohibit_multibyte_space() { assert_prohibited_character(nameprep("\u{1680}")); } // 4.17 Non-ASCII multibyte space character U+2000 #[test] fn should_map_multibyte_space1() { assert_eq!(" ", nameprep("\u{2000}").unwrap()); } // 4.18 Zero Width Space U+200b #[test] fn should_drop_zero_width_space() { assert_eq!("", nameprep("\u{200b}").unwrap()); } // 4.19 Non-ASCII multibyte space character U+3000 #[test] fn should_map_multibyte_space2() { assert_eq!(" ", nameprep("\u{3000}").unwrap()); } // 4.20 ASCII control characters U+0010 U+007F #[test] fn should_permit_ascii_control() { assert_eq!("\u{0010}\u{007f}", nameprep("\u{0010}\u{007f}").unwrap()); } // 4.21 Non-ASCII 8bit control character U+0085 #[test] fn should_prohibit_8bit_control() { assert_prohibited_character(nameprep("\u{0085}")); } // 4.22 Non-ASCII multibyte control character U+180E #[test] fn should_prohibit_multibyte_control() { assert_prohibited_character(nameprep("\u{180e}")); } // 4.23 Zero Width No-Break Space U+FEFF #[test] fn should_drop_zero_width_no_break_space() { assert_eq!("", nameprep("\u{feff}").unwrap()); } // 4.24 Non-ASCII control character U+1D175 #[test] fn should_prohibit_non_ascii_control() { assert_prohibited_character(nameprep("\u{1d175}")); } // 4.25 Plane 0 private use character U+F123 #[test] fn should_prohibit_plane0_private_use() { assert_prohibited_character(nameprep("\u{f123}")); } // 4.26 Plane 15 private use character U+F1234 #[test] fn should_prohibit_plane15_private_use() { assert_prohibited_character(nameprep("\u{f1234}")); } // 4.27 Plane 16 private use character U+10F234 #[test] fn should_prohibit_plane16_private_use() { assert_prohibited_character(nameprep("\u{10f234}")); } // 4.28 Non-character code point U+8FFFE #[test] fn should_prohibit_non_character1() { assert_prohibited_character(nameprep("\u{8fffe}")); } // 4.29 Non-character code point U+10FFFF #[test] fn should_prohibit_non_character2() { assert_prohibited_character(nameprep("\u{10ffff}")); } // 4.31 Non-plain text character U+FFFD #[test] fn should_prohibit_non_plain_text() { assert_prohibited_character(nameprep("\u{fffd}")); } // 4.32 Ideographic description character U+2FF5 #[test] fn should_prohibit_ideographic_description() { assert_prohibited_character(nameprep("\u{2ff5}")); } // 4.33 Display property character U+0341 #[test] fn should_normalize_display_property() { assert_eq!("\u{0301}", nameprep("\u{0341}").unwrap()); } // 4.34 Left-to-right mark U+200E #[test] fn should_prohibit_left_to_right_mark() { assert_prohibited_character(nameprep("\u{200e}")); } // 4.35 Deprecated U+202A #[test] fn should_prohibit_deprecated() { assert_prohibited_character(nameprep("\u{202a}")); } // 4.36 Language tagging character U+E0001 #[test] fn should_prohibit_language_tagging1() { assert_prohibited_character(nameprep("\u{e0001}")); } // 4.37 Language tagging character U+E0042 #[test] fn should_prohibit_language_tagging2() { assert_prohibited_character(nameprep("\u{e0042}")); } // 4.38 Bidi: RandALCat character U+05BE and LCat characters #[test] fn should_prohibit_randalcat_with_lcat1() { assert_prohibited_bidirectional_text(nameprep("foo\u{05be}bar")); } // 4.39 Bidi: RandALCat character U+FD50 and LCat characters #[test] fn should_prohibit_randalcat_with_lcat2() { assert_prohibited_bidirectional_text(nameprep("foo\u{fd50}bar")); } // 4.40 Bidi: RandALCat character U+FB38 and LCat characters #[test] fn should_permit_randalcat1() { assert_eq!("foo \u{064e}bar", nameprep("foo\u{fe76}bar").unwrap()); } // 4.41 Bidi: RandALCat without trailing RandALCat U+0627 U+0031 #[test] fn should_prohibit_mixed_randalcat() { assert_prohibited_bidirectional_text(nameprep("\u{0672}\u{0031}")); } // 4.42 Bidi: RandALCat character U+0627 U+0031 U+0628 #[test] fn should_permit_randalcat2() { assert_eq!( "\u{0627}\u{0031}\u{0628}", nameprep("\u{0627}\u{0031}\u{0628}").unwrap() ); } // 4.43 Unassigned code point U+E0002 #[test] fn should_prohibit_unassigned_code_point() { assert_prohibited_character(nameprep("\u{e0002}")); } // 4.44 Larger test (shrinking) #[test] fn should_shrink() { let input = "X\u{00ad}\u{00df}\u{0130}\u{2121}j\u{030c}\u{00a0}\u{00aa}\u{03b0}\u{2000}"; let output = "xssi\u{0307}tel\u{01f0} a\u{03b0}\u{0020}"; assert_eq!(output, nameprep(input).unwrap()); } // 4.45 Larger test (expanding) #[test] fn should_expand() { let input = "X\u{00df}\u{3316}\u{0130}\u{2121}\u{249f}\u{3300}"; let output = "xss\u{30ad}\u{30ed}\u{30e1}\u{30fc}\u{30c8}\u{30eb}\u{0069}\u{0307}\u{0074}\u{0065}\u{006c}\u{0028}\u{0064}\u{0029}\u{30a2}\u{30d1}\u{30fc}\u{30c8}"; assert_eq!(output, nameprep(input).unwrap()); } stringprep-0.1.5/tests/nodeprep_tests.rs000064400000000000000000000003711046102023000165730ustar 00000000000000// Examples from http://josefsson.org/idn.php extern crate stringprep; use stringprep::nodeprep; #[test] fn test_nodeprep() { assert_eq!( "räksmörgås.josefsson.org", nodeprep("räksmörgås.josefßon.org").unwrap() ); } stringprep-0.1.5/tests/saslprep_tests.rs000064400000000000000000000041351046102023000166120ustar 00000000000000// Integration tests from https://github.com/reklatsmasters/saslprep (MIT License) extern crate stringprep; use stringprep::{saslprep, Error}; fn assert_prohibited_character(result: Result) { assert!(result.is_err()); } fn assert_prohibited_bidirectional_text(result: Result) { assert!(result.is_err()); } #[test] fn should_work_with_latin_letters() { assert_eq!(saslprep("user").unwrap(), "user"); } #[test] fn should_preserve_case() { assert_eq!(saslprep("USER").unwrap(), "USER"); } #[test] fn should_remove_mapped_to_nothing() { assert_eq!(saslprep("I\u{00AD}X").unwrap(), "IX"); } #[test] fn should_replace_non_ascii_space() { assert_eq!(saslprep("a\u{00A0}b").unwrap(), "a\u{0020}b"); } #[test] fn should_normalize_as_nfkc() { assert_eq!(saslprep("\u{00AA}").unwrap(), "a"); assert_eq!(saslprep("\u{2168}").unwrap(), "IX"); } #[test] fn should_not_allow_prohibited_characters() { // C.2.1 ASCII control characters assert_prohibited_character(saslprep("a\u{007F}b")); // C.2.2 Non-ASCII control characters assert_prohibited_character(saslprep("a\u{06DD}b")); // C.3 Private use assert_prohibited_character(saslprep("a\u{E000}b")); // C.4 Non-character code points assert_prohibited_character(saslprep("a\u{1FFFE}b")); // C.5 Surrogate codes // forbidden by rust // C.6 Inappropriate for plain text assert_prohibited_character(saslprep("a\u{FFF9}b")); // C.7 Inappropriate for canonical representation assert_prohibited_character(saslprep("a\u{2FF0}b")); // C.8 Change display properties or are deprecated assert_prohibited_character(saslprep("a\u{200E}b")); // C.9 Tagging characters assert_prohibited_character(saslprep("a\u{E0001}b")); } #[test] fn randalcat_should_be_first_and_last() { assert_eq!( saslprep("\u{0627}\u{0031}\u{0628}").unwrap(), "\u{0627}\u{0031}\u{0628}" ); assert_prohibited_bidirectional_text(saslprep("\u{0627}\u{0031}")); } #[test] fn should_handle_unassigned_code_points() { assert_prohibited_character(saslprep("a\u{0487}")); }