Esempio n. 1
0
File: runes.go Progetto: nilium/leks
func writeRune(w io.Writer, r rune) (int, error) {
	if w, ok := w.(runeWriter); ok {
		return w.WriteRune(r)
	}

	var encoded [4]byte
	subset := encoded[:utf8.EncodeRune(encoded[:], r)]
	if len(subset) == 0 {
		return 0, nil
	}

	return w.Write(subset)
}