Moved the utf8 stuff to utils.c