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

strings: "priority" and "special casing rules" in ToLowerSpecial doc unclear #26654

Closed
willfaught opened this issue Jul 28, 2018 · 10 comments
Closed
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@willfaught
Copy link
Contributor

$ go doc strings ToLowerSpecial
func ToLowerSpecial(c unicode.SpecialCase, s string) string
    ToLowerSpecial returns a copy of the string s with all Unicode letters
    mapped to their lower case, giving priority to the special casing rules.

It's unclear to me what "priority" and "special casing rules" mean.

The package doc says "For information about UTF-8 strings in Go, see https://blog.golang.org/strings." Searching that page for "special", "case", etc. didn't seem to point to anything related to special casing or priority.

System details

go version go1.10.3 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/will/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/will/Developer/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.3/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/t3/p8srlt1j4473h_4ptph5r1xh0000gn/T/go-build611520741=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOROOT/bin/go version: go version go1.10.3 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.10.3
uname -v: Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G65
lldb --version: lldb-902.0.79.7
  Swift-4.1
@ianlancetaylor
Copy link
Contributor

The special casing rules here handled by this function are specifically those in the argument c. See https://golang.org/pkg/unicode#SpecialCase.

There is a bit of background on this at http://www.unicode.org/reports/tr44/#Casemapping.

@ianlancetaylor ianlancetaylor added arch-wasm WebAssembly issues Documentation help wanted NeedsFix The path to resolution is known, but the work has not been done. and removed arch-wasm WebAssembly issues labels Jul 28, 2018
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Jul 28, 2018
@agnivade
Copy link
Contributor

@ianlancetaylor - Does this sound okay ?

// ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their
// upper case, using the language-specific case mapping specified by c.
// You should use this function if you need to do case-insensitive string comparison
// in a specific language.

@vikramcse
Copy link

Hi, Can I take this issue as my first contribution? :)

@agnivade
Copy link
Contributor

Sure :)

@ianlancetaylor
Copy link
Contributor

@agnivade Thanks, I think the first sentence is fine but I would drop the second sentence. The truth is that if you want case-insensitive string comparison in a specific language you should probably be using golang.org/x/text/search.

@vikramcse
Copy link

@agnivade @ianlancetaylor I think the term special case in the go doc points to language-specific case mappings

Does this comment sounds good?

// ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their
// upper case, using the language-specific case mapping specified by c.
// Use this function if you need to do language-specific case mappings such as Turkish or Azeri.

@agnivade
Copy link
Contributor

agnivade commented Aug 3, 2018

I think the second sentence just repeats the last part of the first sentence. You can send a CL with only the first sentence. Users can always click on c to see more.

@gopherbot
Copy link

Change https://golang.org/cl/127716 mentions this issue: strings: revised ToUpperSpecial and ToLowerSpecial wording

@kzisme
Copy link
Contributor

kzisme commented Aug 3, 2018

@ianlancetaylor I just submitted a PR for this issue - as it is my first one let me know if anything is incorrect. I wasn't sure if anyone was still working on this since a few days had passed - my apologies if I stepped on any toes.

@vikramcse
Copy link

vikramcse commented Aug 3, 2018

@kzisme I was working on this, as I can see your CL is under review, you can work on this. Thanks

@bradfitz bradfitz modified the milestones: Unplanned, Go1.12 Aug 3, 2018
@golang golang locked and limited conversation to collaborators Aug 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

7 participants