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

Ranging over string of int gives wrong output #40325

Closed
gandharvas opened this issue Jul 21, 2020 · 2 comments
Closed

Ranging over string of int gives wrong output #40325

gandharvas opened this issue Jul 21, 2020 · 2 comments

Comments

@gandharvas
Copy link

@gandharvas gandharvas commented Jul 21, 2020

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

$ go version
go1.14.6

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
Windows

What did you do?

https://play.golang.org/p/1RVQkIi61nI

What did you expect to see?

1 2 3 4

What did you see instead?

49 50 51 52

@gandharvas
Copy link
Author

@gandharvas gandharvas commented Jul 21, 2020

Can I work on this issue and fix?

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jul 21, 2020

This is correct behavior. The string is Unicode, and the Unicode value for 1 is decimal 49 (https://www.codetable.net/decimal/49).

Compare to https://play.golang.org/p/vOaWa9sdw0e.

Closing because this is not a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.