You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
string(x) doesn't do what you think it does when x is an integer. It interprets x as a unicode code point and creates a string with the UTF-8 encoding of said code point, if possible. For your particular case, it isn't possible, so you get an encoding of unicode.ReplacementChar instead: https://play.golang.org/p/qLfoV6dj_AK
To format an integer into a string, use the fmt or strconv package.
What version of Go are you using (
go version
)?1.14.3
Does this issue reproduce with the latest release?
I think earlier may have the same issue, I have checked other repos have used the same approach.
What operating system and processor architecture are you using (
go env
)?NA
What did you do?
Converting nano time to string
fmt.Println(string(time.Now().UnixNano()))
What did you expect to see?
As expected number return by nano time.
What did you see instead?
A question mark character
https://play.golang.com/p/7NfnDfYy4_N
The text was updated successfully, but these errors were encountered: