POSIXly, emphasis mine:
3.87 Character
A sequence of one or more bytes representing a single graphic symbol or control code.
In practice, the exact meaning depends on the locale in effect, e.g. under the "C" locale, printf '\xc3\xa4\xc3\xb6' |wc -m
gives 4, since it effectively counts bytes; while under a UTF-8 locale that gives 2, since that's the two UTF-8 encoded characters äö
. Assuming your terminal is also set to UTF-8, you could of course just write printf 'äö'
.
(Note that wc -c
is defined to count bytes, not characters, confusingly enough.)
Worse, character support also depends on the utility, and not everything deals with multi-byte characters cleanly (let alone all the quirks of Unicode). E.g. GNU tr deals with bytes, regardless of what its man page says:
$ printf ä | tr ä xy; echo
xx
$ printf ö | tr ä xy; echo
x�
The first is same as tr '\303\244' 'xy'
, so both bytes of ä
get replaced, and that second happens because the first byte of both ä
and ö
is the same. Of course, if it really dealt with characters, those should print x
and ö
.