Просмотр исходного кода

Use is_combining_mark from unicode_normalization.

Simon Sapin 10 лет назад
Родитель
Сommit
497742f77e
3 измененных файлов с 4 добавлено и 10 удалено
  1. 2 2
      Cargo.toml
  2. 1 8
      src/idna.rs
  3. 1 0
      tests/tests.rs

+ 2 - 2
Cargo.toml

@@ -1,7 +1,7 @@
 [package]
 
 name = "url"
-version = "0.5.2"
+version = "0.5.3"
 authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]
 
 description = "URL library for Rust, based on the WHATWG URL Standard"
@@ -36,5 +36,5 @@ optional = true
 uuid = "0.1.17"
 rustc-serialize = "0.3"
 unicode-bidi = "0.2.3"
-unicode-normalization = "0.1.1"
+unicode-normalization = "0.1.2"
 matches = "0.1"

+ 1 - 8
src/idna.rs

@@ -6,7 +6,7 @@ use idna_mapping::TABLE;
 use punycode;
 use std::ascii::AsciiExt;
 use unicode_normalization::UnicodeNormalization;
-use unicode_normalization::char::canonical_combining_class;
+use unicode_normalization::char::is_combining_mark;
 use unicode_bidi::{BidiClass, bidi_class};
 
 #[derive(Debug)]
@@ -74,13 +74,6 @@ fn map_char(codepoint: char, flags: Uts46Flags, output: &mut String) -> Result<(
     Ok(())
 }
 
-// XXX: This passes the tests, but isn't correct
-//      Should return true if General_Category=Mark
-//      We should try to get this info into unicode_normalization
-fn is_combining_mark(c: char) -> bool {
-    canonical_combining_class(c) != 0
-}
-
 // http://tools.ietf.org/html/rfc5893#section-2
 fn passes_bidi(label: &str, transitional_processing: bool) -> bool {
     let mut chars = label.chars();

+ 1 - 0
tests/tests.rs

@@ -374,4 +374,5 @@ fn host() {
 #[test]
 fn test_idna() {
     assert!("http://goșu.ro".parse::<Url>().is_ok());
+    assert_eq!(Url::parse("http://☃.net/").unwrap().domain(), Some("xn--n3h.net"));
 }