Skip to content

Commit

Permalink
confusable: ignore replacement characters
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tulir committed Jan 16, 2025
1 parent 0b53494 commit 4cda3e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions confusable/skeleton.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func Skeleton(input string) string {
var builder strings.Builder
builder.Grow(len(input))
for _, r := range input {
if !unicode.IsGraphic(r) {
if !unicode.IsGraphic(r) && r != 0xfffd {
continue
}
repl := GetReplacement(r)
Expand All @@ -48,7 +48,7 @@ func SkeletonBytes(input string) []byte {
var builder bytes.Buffer
builder.Grow(len(input))
for _, r := range input {
if !unicode.IsGraphic(r) {
if !unicode.IsGraphic(r) && r != 0xfffd {
continue
}
repl := GetReplacement(r)
Expand Down

0 comments on commit 4cda3e4

Please sign in to comment.