在 Rust 中将 unicode 字符串转换为 NFC

Convert unicode string into NFC in Rust

假设我有一个 std::String,内容未知,例如 "Mañana" 具有组合字符,我想将其转换为 unicode NFC,la String.prototype.normalize in Javascript or unicodedata.normalize in Python.

我在 crates.io 上找到了 this crate,但它似乎只包含处理单个字符的方法。我将如何转换整个字符串?转换为字节并成对迭代并使用该板条箱中的函数检查组合字符?生锈后会是什么样子?

您确实可以使用 unicode_normalization 箱子。更具体地说,查看 nfc 方法。