-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move unconfusable_string to liberapay/utils/unconfusable.py
- Loading branch information
1 parent
4883243
commit 9b496bc
Showing
4 changed files
with
26 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from confusable_homoglyphs import confusables | ||
|
||
def unconfusable_string(name): | ||
unconfusable_name = '' | ||
for c in name: | ||
confusable = confusables.is_confusable(c, preferred_aliases=['COMMON', 'LATIN']) | ||
if confusable: | ||
# if the character is confusable we replace it with the first prefered alias | ||
c = confusable[0]['homoglyphs'][0]['c'] | ||
unconfusable_name += c | ||
return unconfusable_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters