Go Strings
Contents
Unicode
The bytes of a Golang string may or may not be valid Unicode characters. There are only a few instances where strings are implicitly encoded:
in for i, r := range s, the r is a Unicode rune
in the conversion []rune(s), whole string is decoded to Unicode runes
In these cases, all invalid Unicode bytes are converted to U+FFFD (replacement character). Go will not crash when writing, printing, etc., an invalid Unicode byte.