Added utf-8 support and a maximum length to chat messages to prevent unexpected disconnects