const runeError … const runeSelf … const maxRune … const surrogateMin … const surrogateMax … const t1 … const tx … const t2 … const t3 … const t4 … const t5 … const maskx … const mask2 … const mask3 … const mask4 … const rune1Max … const rune2Max … const rune3Max … const locb … const hicb … // countrunes returns the number of runes in s. func countrunes(s string) int { … } // decoderune returns the non-ASCII rune at the start of // s[k:] and the index after the rune in s. // // decoderune assumes that caller has checked that // the to be decoded rune is a non-ASCII rune. // // If the string appears to be incomplete or decoding problems // are encountered (runeerror, k + 1) is returned to ensure // progress when decoderune is used to iterate over a string. func decoderune(s string, k int) (r rune, pos int) { … } // encoderune writes into p (which must be large enough) the UTF-8 encoding of the rune. // It returns the number of bytes written. func encoderune(p []byte, r rune) int { … }