diff options
Diffstat (limited to 'util/unicode.go')
-rw-r--r-- | util/unicode.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/util/unicode.go b/util/unicode.go new file mode 100644 index 0000000..4432df5 --- /dev/null +++ b/util/unicode.go | |||
@@ -0,0 +1,15 @@ | |||
1 | package util | ||
2 | |||
3 | func NormalizeString(str string) string { | ||
4 | out := []rune{} | ||
5 | for _, r := range str { | ||
6 | if rpl, ok := unicodeConfusables[r]; ok { | ||
7 | for _, v := range rpl { | ||
8 | out = append(out, v) | ||
9 | } | ||
10 | } else { | ||
11 | out = append(out, r) | ||
12 | } | ||
13 | } | ||
14 | return string(out) | ||
15 | } | ||