diff --git a/Gopkg.lock b/Gopkg.lock index 73ab4a22..a7a47151 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -62,11 +62,11 @@ revision = "9520e82c474b0a04dd04f8a40959027271bab992" [[projects]] - digest = "1:7caf3ea977a13cd8b9a2e1ecef1ccaa8e38f831b4f6ffcb8bd0aa909c48afb3a" + digest = "1:940e48aff4b5fe62c3e6fd1245cc35271327a424b7ffbe4febfa83ff8f9c4f53" name = "github.com/oragono/confusables" packages = ["."] pruneopts = "UT" - revision = "d5dd03409482fae2457f0742be22782890f720c2" + revision = "e65e89839ad43b68dbea2d3ca62f0f1c594b029a" [[projects]] branch = "master" diff --git a/Gopkg.toml b/Gopkg.toml index b4656ed4..ed8deed7 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -50,7 +50,7 @@ name = "github.com/oragono/go-ident" [[constraint]] - revision = "d5dd03409482fae2457f0742be22782890f720c2" + revision = "e65e89839ad43b68dbea2d3ca62f0f1c594b029a" name = "github.com/oragono/confusables" [[constraint]] diff --git a/irc/strings.go b/irc/strings.go index be671164..d0bbf8b1 100644 --- a/irc/strings.go +++ b/irc/strings.go @@ -108,26 +108,6 @@ func CasefoldName(name string) (string, error) { return lowered, err } -// "boring" names are exempt from skeletonization. -// this is because confusables.txt considers various pure ASCII alphanumeric -// strings confusable: 0 and O, 1 and l, m and rn. IMO this causes more problems -// than it solves. -func isBoring(name string) bool { - for i := 0; i < len(name); i += 1 { - chr := name[i] - if (chr >= 'a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z') || (chr >= '0' && chr <= '9') { - continue // alphanumerics - } - switch chr { - case '$', '%', '^', '&', '(', ')', '{', '}', '[', ']', '<', '>', '=': - continue // benign printable ascii characters - default: - return false // potentially confusable ascii like | ' `, non-ascii - } - } - return true -} - // returns true if the given name is a valid ident, using a mix of Insp and // Chary's ident restrictions. func isIdent(name string) bool { @@ -168,9 +148,7 @@ func Skeleton(name string) (string, error) { // same as PRECIS: name = width.Fold.String(name) - if !isBoring(name) { - name = confusables.Skeleton(name) - } + name = confusables.SkeletonTweaked(name) // internationalized lowercasing for skeletons; this is much more lenient than // Casefold. In particular, skeletons are expected to mix scripts (which may diff --git a/irc/strings_test.go b/irc/strings_test.go index 40d32f68..b24bf08d 100644 --- a/irc/strings_test.go +++ b/irc/strings_test.go @@ -128,18 +128,6 @@ func TestCasefoldName(t *testing.T) { } } -func TestIsBoring(t *testing.T) { - assertBoring := func(str string, expected bool) { - if isBoring(str) != expected { - t.Errorf("expected [%s] to have boringness [%t], but got [%t]", str, expected, !expected) - } - } - - assertBoring("warning", true) - assertBoring("phi|ip", false) - assertBoring("Νικηφόρος", false) -} - func TestIsIdent(t *testing.T) { assertIdent := func(str string, expected bool) { if isIdent(str) != expected { diff --git a/vendor b/vendor index 8ddbb531..42b0d2d5 160000 --- a/vendor +++ b/vendor @@ -1 +1 @@ -Subproject commit 8ddbb531841add50f8b7aff8fe00bef311448aaa +Subproject commit 42b0d2d5d24a9b0ed4295fa04fd66e7c4ff27fa8