Skip to content

Commit 4cda3e4

Browse files
committed
confusable: ignore replacement characters
Normalizing the string will return those in some cases and they're considered graphic, but they're not actually in the input string, so they should be dropped from the skeleton.
1 parent 0b53494 commit 4cda3e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

confusable/skeleton.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func Skeleton(input string) string {
2929
var builder strings.Builder
3030
builder.Grow(len(input))
3131
for _, r := range input {
32-
if !unicode.IsGraphic(r) {
32+
if !unicode.IsGraphic(r) && r != 0xfffd {
3333
continue
3434
}
3535
repl := GetReplacement(r)
@@ -48,7 +48,7 @@ func SkeletonBytes(input string) []byte {
4848
var builder bytes.Buffer
4949
builder.Grow(len(input))
5050
for _, r := range input {
51-
if !unicode.IsGraphic(r) {
51+
if !unicode.IsGraphic(r) && r != 0xfffd {
5252
continue
5353
}
5454
repl := GetReplacement(r)

0 commit comments

Comments
 (0)