Encodes UTF-8 strings using the native TextEncoder API.