[FIX] Core: improved handling of UTF16 input