On Linux shell the result of echo -e \"arrays2 2\\narrays 2\\narrays3 2\" | sort is
echo -e \"arrays2 2\\narrays 2\\narrays3 2\" | sort
arrays 2 arrays2 2 arrays3 2
and the result
If you change the locale from en_US.utf8 to the old default, it works the way you expect:
echo -e "aaa\nfoo\narrays2 28\narrays 28\narrays3 28" | LC_ALL=C sort - aaa arrays 28 arrays2 28 arrays3 28 foo