core: move test of invalid UTF-8 char length from gui-chat.c to wee-utf8.c