Search completed in 1.19 seconds.
4 results for "js_c_strings_are_utf8":
Index
es a way for the application to access the contents of that table. It calls the dump function once for each named root in the given runtime rt. In pseudocode: 250 JS_EncodeCharacters JSAPI Reference, Obsolete, SpiderMonkey JS_EncodeCharacters copies the characters of a jschar array into a char array, converting the 16-bit values to 8-bit values. If SpiderMonkey was built with
JS_C_STRINGS_ARE_UTF8 defined or JS_SetCStringsAreUTF8 was called, the string is converted to UTF-8. Otherwise each character is simply truncated to 8 bits. 251 JS_EncodeString JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_EncodeString and JS_EncodeStringToUTF8 convert the specified JavaScript str to a C string (an array of 8-bit chars). 252 JS_EncodeStringToBuffer JSAP...
JSAPI User Guide
To pass Unicode data between JavaScript and native code, represent the data in UTF-16 in memory. JavaScript strings, property names, and programs are all made up of jschars, which are 16-bit unsigned integers. Many JSAPI functions operate on null-terminated, 8-bit char strings. These functions convert their char * arguments to 16-bit strings by zero-extending each 8-bit char to 16 bits--unless
JS_C_STRINGS_ARE_UTF8 is defined or JS_SetCStringsAreUTF8 has been called, in which case each char * string is interpreted as UTF-8 Unicode text. The JSAPI provides jschar-based versions of many API functions that operate on strings, object properties, and JavaScript code. char-based function jschar-based function Unicode data JS_GetStringBytes Obsolete since JavaScript 1.8.5 JS_...
JS_CStringsAreUTF8
ption By default, all C/C++ strings passed into the JSAPI are treated as ISO/IEC 8859-1, also known as ISO-Latin-1. That is, each byte is treated as a Unicode character, and there is no way to pass in a string containing characters beyond U+00FF. However, SpiderMonkey can optionally interpret these strings as UTF-8. There are two ways to enable this: at compile time, by building SpiderMonkey with
JS_C_STRINGS_ARE_UTF8 defined; or at run time, by calling JS_SetCStringsAreUTF8 before the first call to JS_NewRuntime. Enabling this option also causes JS_GetStringBytes and JS_EncodeCharacters to produce UTF-8 strings instead of Latin-1. JS_CStringsAreUTF8 returns JS_TRUE if the JavaScript engine is configured (either at compile time or at run time) to interpret char strings as UTF-8. See Also bug 805080 ...
JS_EncodeCharacters
be the length of the destination string in 16-bit units. On success, *dstlenp receives the length of the converted string, in bytes. On failure, *dstlenp receives the number of bytes written to dst before the error occurred. Description JS_EncodeCharacters copies the characters of a jschar array into a char array, converting the 16-bit values to 8-bit values. If SpiderMonkey was built with
JS_C_STRINGS_ARE_UTF8 defined or JS_SetCStringsAreUTF8 was called, the string is converted to UTF-8. Otherwise each character is simply truncated to 8 bits. If UTF-8 is turned on, the length of the encoded string may vary. To calculate the number of bytes needed, call JS_EncodeCharacters twice, like this: /* Determine how many bytes to allocate. */ size_t dstlen = 0; if (!JS_EncodeCharacters(cx, src, src...