Standard library / bufio

bufio.Reader.ReadRune()

Reads one UTF-8 rune and its byte width; malformed input yields RuneError with width one. Expected stdout: 'é 2 <nil>\n'.

Formal Syntax & Structure

go syntaxgo
func (b *Reader) ReadRune() (r rune, size int, err error)

Return Value

(r rune, size int, err error)

Reads one UTF-8 rune and its byte width; malformed input yields RuneError with width one.

Working Example

Example Snippetgo
package main
import (  "bufio"  "fmt"  "strings")
func main() {  r := bufio.NewReader(strings.NewReader("é"))  c, n, e := r.ReadRune()  fmt.Println(string(c), n, e)}
Go Reference