Skip to content

SkygearIO/go-confusable-homoglyphs

Repository files navigation

confusable_homoglyphs

Golang version of Python library https://github.com/vhf/confusable_homoglyphs

Example

package main

import (
	"fmt"

	confusable "github.com/skygeario/go-confusable-homoglyphs"
)

func main() {

	// detact mixed script and confusable
	isDangerous := confusable.IsDangerous("AlaskaJazz", []string{})
	fmt.Println(isDangerous) // should be false

	isDangerous = confusable.IsDangerous("ΑlaskaJazz", []string{})
	fmt.Println(isDangerous) // should be true

	// detect confusable with preferred aliases
	confusables := confusable.IsConfusable("microsoft", false, []string{"latin", "common"})
	fmt.Println(confusables) // should be empty

	confusables = confusable.IsConfusable("microsоft", false, []string{"latin", "common"})
	fmt.Println(confusables) // should show confusable homoglyphs
}

Releases

No releases published

Packages

No packages published

Languages