Use any_ascii
crate to convert unicode
This commit is contained in:
parent
cad596cdf3
commit
97bb5a1775
3 changed files with 11 additions and 11 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
@ -270,6 +270,12 @@ version = "0.1.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70033777eb8b5124a81a1889416543dddef2de240019b674c81285a2635a7e1e"
|
||||
|
||||
[[package]]
|
||||
name = "any_ascii"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea50b14b7a4b9343f8c627a7a53c52076482bd4bdad0a24fd3ec533ed616cc2c"
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.70"
|
||||
|
@ -1056,12 +1062,6 @@ dependencies = [
|
|||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deunicode"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c1bba4f227a4a53d12b653f50ca7bf10c9119ae2aba56aff9e0338b5c98f36a"
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.6"
|
||||
|
@ -2050,7 +2050,7 @@ version = "0.3.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c09e4591611e231daf4d4c685a66cb0410cc1e502027a20ae55f2bb9e997207a"
|
||||
dependencies = [
|
||||
"any_ascii",
|
||||
"any_ascii 0.1.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3620,6 +3620,7 @@ name = "surrealdb"
|
|||
version = "1.0.0-beta.8"
|
||||
dependencies = [
|
||||
"addr",
|
||||
"any_ascii 0.3.2",
|
||||
"argon2",
|
||||
"async-channel",
|
||||
"async-executor",
|
||||
|
@ -3627,7 +3628,6 @@ dependencies = [
|
|||
"bcrypt",
|
||||
"bigdecimal",
|
||||
"chrono",
|
||||
"deunicode",
|
||||
"dmp",
|
||||
"echodb",
|
||||
"env_logger 0.10.0",
|
||||
|
|
|
@ -52,13 +52,13 @@ targets = []
|
|||
[dependencies]
|
||||
addr = { version = "0.15.6", default-features = false, features = ["std"] }
|
||||
argon2 = "0.5.0"
|
||||
ascii = { version = "0.3.2", package = "any_ascii" }
|
||||
async-recursion = "1.0.4"
|
||||
bcrypt = "0.14.0"
|
||||
bigdecimal = { version = "0.3.0", features = ["serde", "string-only"] }
|
||||
channel = { version = "1.8.0", package = "async-channel" }
|
||||
chrono = { version = "0.4.24", features = ["serde"] }
|
||||
derive = { version = "0.5.0", package = "surrealdb-derive" }
|
||||
deunicode = "1.3.3"
|
||||
dmp = "0.1.2"
|
||||
echodb = { version = "0.3.0", optional = true }
|
||||
executor = { version = "1.5.0", package = "async-executor" }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use deunicode::deunicode;
|
||||
use ascii::any_ascii as ascii;
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::Regex;
|
||||
|
||||
|
@ -9,7 +9,7 @@ pub fn slug<S: AsRef<str>>(s: S) -> String {
|
|||
// Get a reference
|
||||
let s = s.as_ref();
|
||||
// Convert unicode to ascii
|
||||
let mut s = deunicode(s);
|
||||
let mut s = ascii(s);
|
||||
// Convert string to lowercase
|
||||
s.make_ascii_lowercase();
|
||||
// Replace any non-simple characters
|
||||
|
|
Loading…
Reference in a new issue