If I change the type to string, I'm able to read it. So what you're telling
me is that the purpose of rune is not to represent a single character of a
go string, but instead to represent a character of a string of any encoding
(that has 4-byte or less characters)? And when I use %c I'm saying, "hey,
this rune is actually a go string character".
Post by 2***@public.gmane.orgRight, thanks. But I'm wondering if this is the correct choice of
interface for Scan. Seems like reading characters is a lot more common than
reading integers as runes. And I think it's very natural to expect the
character behavior.
A rune is 4bytes, Your 'a' is 1 byte(assuming your terminal input is
ascii or utf8).
If your terminal input in utf32 then fmt.Scanf() would work as you expect
as your 'a' would be 4bytes.
Go doesn't know about your terminal so it can't know what encoding it uses.
--