string functions, sorting, and UTF-8 fixes