added safe_utf8to16