Swift字符串比较使用什么样的规范化?

时间:2016-01-31 15:44:54

标签: string swift unicode comparison unicode-normalization

Elsewhere I've seen it told Swift的比较使用NFD标准化。

然而,running in the iSwift playground我发现了

print("\u{0071}\u{0307}\u{0323}" == "\u{0071}\u{0323}\u{0307}");

给出了false,尽管是this being an example straight from the standard的“Canonical Equivalence”,Swift's documentation claims to follow

那么,Swift执行什么样的规范化 ,这是一个错误吗?

1 个答案:

答案 0 :(得分:4)

这似乎是Swift中的bug已经被修复了。使用Swift 3和Xcode 8.0,

print("\u{0071}\u{0307}\u{0323}" == "\u{0071}\u{0323}\u{0307}")

现在打印true