diff --git a/pkgs/id/src/petname.rs b/pkgs/id/src/petname.rs index e5f620454f..d8996c24ef 100644 --- a/pkgs/id/src/petname.rs +++ b/pkgs/id/src/petname.rs @@ -303,16 +303,19 @@ pub fn fold(name: &str) -> String { } /// The name with look-alike characters mapped to one form, so `PayPa1` and -/// `PayPal` compare equal. +/// `PayPal` compare equal. The fold lowercases first, so capital `I` lands +/// in the `i` class and maps to `l` with `1` and `|` (#2069); `8` maps to +/// `b`, symmetric with the other mapped digits. #[must_use] pub fn skeleton(name: &str) -> String { let mapped: String = fold(name) .chars() .map(|c| match c { '0' => 'o', - '1' | '|' => 'l', + '1' | '|' | 'i' => 'l', '3' => 'e', '5' | '$' => 's', + '8' => 'b', '@' => 'a', other => other, }) @@ -373,18 +376,19 @@ pub fn fingerprint(id: &str) -> String { } /// How each contact is shown: its petname if it has one, otherwise its -/// alleged name marked unverified. Petnames that collide after folding get a -/// fingerprint on both contacts. +/// alleged name marked unverified. Petnames that collide by skeleton +/// (look-alike) comparison get a fingerprint on both contacts, so a legacy +/// stored name that `set` would now refuse still renders distinctly (#2069). #[must_use] pub fn labels(contacts: &[Contact<'_>]) -> Vec