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
cmd/go: Program exits abruptly with the 語 character #50105
Comments
The program doesn't terminate, just your terminal can't display what it considers to be invalid output. Closing as not a bug in |
@seankhliao In that case shouldn't the 2nd for loop at least run and print Output beginning with "Rune at byte position..." ? even if it doesn't print the actual characters ? @zyxkad I am running Fedora on my laptop, Already gave the Go version above, Could you try this Golang online compiler here https://www.onlinegdb.com/online_go_compiler and try out the below program ? You can see that 2nd loop doesn't show all the characters either
Here is the output I see on the above Golang online playground
|
For questions about how Go works and how to use it, please use a forum, not the issue tracker. See https://golang.org/wiki/Questions. Thanks. |
I was playing around with a simple program to see how bytes/runes work
Running it gave the expected results
Next I thought of using words from a different language for s
Did you notice what happened ? The second for loop never ran ?
What ?
Ok, next I tried to insert a fmt.Println to print random "======"
Same behavior ? So the problem lies in the first for loop
To narrow down the issue, I chose a different set of characters from the same language
This time it ran fine, second for loop executed. Hmmm
I focused on the problematic characters picking one at a time
Program worked fine for this character
Moved to the next character
Again worked fine
Which leaves the final character
And as expected the program seems to exit ? Second for loop never printed
I tried running the program on the Go playground and it seemed to work fine there
I am using the following version of Go on a Fedora distribution
If you notice where the exit happens
It seems its coming from this line, so is %c or %x the problem here ?
Anybody else able to reproduce it on the exact same version ?
I casually tried to reproduce the issue on various different online Go playgrounds (non-Google) too, by adding the line below to programs
I am also seeing the issue on below version for an online playground here (https://www.onlinegdb.com/online_go_compiler)
The text was updated successfully, but these errors were encountered: