Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/text/collate: ignores width even if the flag is not specified #23241

Open
sougou opened this issue Dec 26, 2017 · 1 comment
Open

x/text/collate: ignores width even if the flag is not specified #23241

sougou opened this issue Dec 26, 2017 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@sougou
Copy link
Contributor

sougou commented Dec 26, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.9 linux/amd64

Does this issue reproduce with the latest release?

Did not check.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/home/sougou/dev/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/sougou/dev"
GORACE=""
GOROOT="/home/sougou/go"
GOTOOLDIR="/home/sougou/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build590551857=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

I was spot-checking the collation code to see if it matched specifications: if IgnoreWidth was not specified, I was expecting "ae" to not match "Æ". However, it still matched. Here's a simplified reproduction:

import (
        "testing"

        "golang.org/x/text/collate"
        "golang.org/x/text/language"
)

func TestUtf8GeneralCI(t *testing.T) {
        a := "ae"
        b := "Æ"
        coll := collate.New(language.Und, collate.IgnoreCase, collate.IgnoreDiacritics)
        if coll.CompareString(a, b) == 0 {
                t.Errorf("Compare(%q, %q): 0, want non-0", a, b)
        }
}

What did you expect to see?

Test should pass.

What did you see instead?

Test failed.

@gopherbot gopherbot added this to the Unreleased milestone Dec 26, 2017
@ianlancetaylor
Copy link
Contributor

CC @mpvl

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants