When I used cut today, I found out it doesn't treat a UTF-8 character as a character, but 3 characters because it's 3 bytes long.
This seems to be generally true for many tools.
Are there versions of the coreutils that are UTF-8 aware?
My locale output:
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Here is when cut doesn't work
echo 哈哈 | cut -c 2-
��哈
The right output should be
哈
if cut -c worked with multibyte characters.
localeproperly? What's the reading oflocale(w/o arguments) command invocation? – alex Jul 2 '11 at 5:00cutcommand line? – alex Jul 2 '11 at 5:40echo ßßßß | cut -c 2-->�ßßß(LANG=en_US.UTF-8) – maxschlepzig Jul 2 '11 at 8:52