Function mozjs_sys::jsapi::JS_EncodeStringToUTF8

source ·
pub unsafe extern "C" fn JS_EncodeStringToUTF8(
    cx: *mut JSContext,
    str_: Handle<*mut JSString>,
) -> UniqueChars
Expand description

DEPRECATED

Same behavior as JS_EncodeStringToLatin1(), but encode into a UTF-8 string.

This function loses information when it copies the characters of |str| if |str| contains invalid UTF-16: U+FFFD REPLACEMENT CHARACTER will be copied instead.

The returned string is also subject to misinterpretation if |str| contains any nulls (which are faithfully transcribed into the returned string, but which will implicitly truncate the string if it’s passed to functions that expect null-terminated strings).

Avoid using this function if possible, because we’ll remove it once we can devise a better API for the task.