internal/bufio/bufio.go
func (w *Writer) WriteCesu8(p []byte) int {
	if w.err != nil {
		return 0
	}
	w.tr.Reset()
	cnt := 0
	i := 0
	for i < len(p) {
		m, n, err := w.tr.Transform(w.b, p[i:], true)
		if err != nil && err != transform.ErrShortDst {
			w.err = err
			return cnt
		}
		if m == 0 {
			w.err = transform.ErrShortDst
			return cnt
		}
		o, _ := w.wr.Write(w.b[:m])
		cnt += o
		i += n
	}
	return cnt
}
func (w *Writer) WriteCesu8(p []byte) int {
	if w.err != nil {
		return 0
	}
	w.tr.Reset()
	cnt := 0
	i := 0
	for i < len(p) {
		m, n, err := w.tr.Transform(w.b, p[i:], true)
		if err != nil && err != transform.ErrShortDst {
			w.err = err
			return cnt
		}
		if m == 0 {
			w.err = transform.ErrShortDst
			return cnt
		}
		o, _ := w.wr.Write(w.b[:m])
		cnt += o
		i += n
	}
	return cnt
}
func ( w * Writer ) WriteCesu8 ( p [ ] byte ) int { if w . err != nil { return 0 } w . tr . Reset ( ) cnt := 0 i := 0 for i < len ( p ) { m , n , err := w . tr . Transform ( w . b , p [ i : ] , true ) if err != nil && err != transform . ErrShortDst { w . err = err return cnt } if m == 0 { w . err = transform . ErrShortDst return cnt } o , _ := w . wr . Write ( w . b [ : m ] ) cnt += o i += n } return cnt }
// WriteCesu8 writes an UTF-8 byte slice as CESU-8 and returns the CESU-8 bytes written.
WriteCesu8 writes an UTF - 8 byte slice as CESU - 8 and returns the CESU - 8 bytes written .