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: Region.ISO3() doesn't return ISO 3166-1 alpha-3 #30360

Closed
dpifke opened this issue Feb 23, 2019 · 2 comments
Closed

x/text: Region.ISO3() doesn't return ISO 3166-1 alpha-3 #30360

dpifke opened this issue Feb 23, 2019 · 2 comments

Comments

@dpifke
Copy link
Contributor

dpifke commented Feb 23, 2019

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

go version go1.12beta2 linux/amd64
golang.org/x/text master (6c92c7d)

Does this issue reproduce with the latest release?

Yes.

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/dave/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/dave/Source/Go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go-1.12"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.12/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build800313732=/tmp/go-build -gno-record-gcc-switches"

What did you do?

package main

import (
    "fmt"
    "golang.org/x/text/language"
)

func main() {
    region, _ := language.AmericanEnglish.Region()
    fmt.Println(region.ISO3()) // expect "USA", got "US"

    region, _ = language.LatinAmericanSpanish.Region()
    fmt.Println(region.ISO3()) // expect "ZZZ" (maybe?), got "419"
}

What did you expect to see?

The documentation states:

ISO3 returns the 3-letter ISO code of r. Note that not all regions have a 3-letter ISO code. In such cases this method returns "ZZZ".

What did you see instead?

ISO3166-1 alpha-2 in the first example, UN M.49 in the second.

Also worth noting that the docs should probably clarify ISO 639-3 vs. ISO 3166-1; "ISO" is ambiguously used for both.

@gopherbot gopherbot added this to the Unreleased milestone Feb 23, 2019
@MaxSem
Copy link

MaxSem commented Feb 26, 2019

Looks like it was fixed 5 days ago by golang/text@d14c52b - can you verify?

@dpifke
Copy link
Contributor Author

dpifke commented Feb 26, 2019

Looks fixed from here. Thanks!

@dpifke dpifke closed this as completed Feb 26, 2019
@golang golang locked and limited conversation to collaborators Feb 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants