mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
468275ac79
This API doesn't serve much purpose, and is only likely to cause confusion and bugs. The intention was that this would return the number of characters in a string independent of encoding, but that's not generally useful. In almost all cases, one of the encoding-specific napi_get_value_string_* APIs is more correct. (Pass a null buffer if only the encoded length is desired.) Anyway the current implementation of napi_get_value_string_length() is technically wrong: it returns the number of 2-byte code units of the UTF-16 encoding, but there are actually some characters that are encoded as two UTF-16 code units. Note the JavaScript String.prototype.length property returns the number of UTF-16 code units, which may be different from the number of characters. So, getting the true character count is not common with JavaScript, and is probably best left to specialized internationalization libraries. PR-URL: https://github.com/nodejs/node/pull/12496 Fixes: https://github.com/nodejs/abi-stable-node/issues/226 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> |
||
---|---|---|
.. | ||
1_hello_world | ||
2_function_arguments | ||
3_callbacks | ||
4_object_factory | ||
5_function_factory | ||
6_object_wrap | ||
7_factory_wrap | ||
8_passing_wrapped | ||
test_array | ||
test_async | ||
test_buffer | ||
test_constructor | ||
test_conversions | ||
test_error | ||
test_exception | ||
test_function | ||
test_handle_scope | ||
test_instanceof | ||
test_napi_status | ||
test_number | ||
test_object | ||
test_properties | ||
test_string | ||
test_symbol | ||
test_typedarray | ||
.gitignore | ||
common.h | ||
testcfg.py |