@@ -1462,51 +1462,51 @@ The JavaScript Number type is described in
1462
1462
[Section 6.1.6](https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type)
1463
1463
of the ECMAScript Language Specification.
1464
1464
1465
- #### *napi_create_string_utf16 *
1465
+ #### *napi_create_string_latin1 *
1466
1466
<!-- YAML
1467
1467
added: v8.0.0
1468
1468
-->
1469
1469
```C
1470
- napi_status napi_create_string_utf16 (napi_env env,
1471
- const char16_t * str,
1472
- size_t length,
1473
- napi_value* result)
1470
+ NAPI_EXTERN napi_status napi_create_string_latin1 (napi_env env,
1471
+ const char * str,
1472
+ size_t length,
1473
+ napi_value* result);
1474
1474
```
1475
1475
1476
1476
- ` [in] env ` : The environment that the API is invoked under.
1477
- - ` [in] str ` : Character buffer representing a UTF16-LE -encoded string.
1478
- - ` [in] length ` : The length of the string in two-byte code units , or -1 if
1479
- it is null-terminated.
1477
+ - ` [in] str ` : Character buffer representing a ISO-8859-1 -encoded string.
1478
+ - ` [in] length ` : The length of the string in bytes , or -1 if it is
1479
+ null-terminated.
1480
1480
- ` [out] result ` : A ` napi_value ` representing a JavaScript String.
1481
1481
1482
1482
Returns ` napi_ok ` if the API succeeded.
1483
1483
1484
- This API creates a JavaScript String object from a UTF16-LE- encoded C string
1484
+ This API creates a JavaScript String object from a ISO-8859-1- encoded C string.
1485
1485
1486
1486
The JavaScript String type is described in
1487
1487
[ Section 6.1.4] ( https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type )
1488
1488
of the ECMAScript Language Specification.
1489
1489
1490
- #### * napi_create_string_latin1 *
1490
+ #### * napi_create_string_utf16 *
1491
1491
<!-- YAML
1492
1492
added: v8.0.0
1493
1493
-->
1494
1494
``` C
1495
- NAPI_EXTERN napi_status napi_create_string_latin1 (napi_env env,
1496
- const char * str,
1497
- size_t length,
1498
- napi_value* result);
1495
+ napi_status napi_create_string_utf16 (napi_env env,
1496
+ const char16_t * str,
1497
+ size_t length,
1498
+ napi_value* result)
1499
1499
```
1500
1500
1501
1501
- `[in] env`: The environment that the API is invoked under.
1502
- - `[in] str`: Character buffer representing a latin1 -encoded string.
1503
- - `[in] length`: The length of the string in bytes , or -1 if it is
1504
- null-terminated.
1502
+ - `[in] str`: Character buffer representing a UTF16-LE -encoded string.
1503
+ - `[in] length`: The length of the string in two-byte code units , or -1 if
1504
+ it is null-terminated.
1505
1505
- `[out] result`: A `napi_value` representing a JavaScript String.
1506
1506
1507
1507
Returns `napi_ok` if the API succeeded.
1508
1508
1509
- This API creates a JavaScript String object from a latin1- encoded C string.
1509
+ This API creates a JavaScript String object from a UTF16-LE- encoded C string
1510
1510
1511
1511
The JavaScript String type is described in
1512
1512
[Section 6.1.4](https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type)
@@ -1795,6 +1795,33 @@ is passed in it returns `napi_number_expected`.
1795
1795
This API returns the C int64 primitive equivalent of the given
1796
1796
JavaScript Number
1797
1797
1798
+ #### *napi_get_value_string_latin1*
1799
+ <!-- YAML
1800
+ added: v8.0.0
1801
+ -->
1802
+ ```C
1803
+ NAPI_EXTERN napi_status napi_get_value_string_latin1(napi_env env,
1804
+ napi_value value,
1805
+ char* buf,
1806
+ size_t bufsize,
1807
+ size_t* result)
1808
+ ```
1809
+
1810
+ - ` [in] env ` : The environment that the API is invoked under.
1811
+ - ` [in] value ` : ` napi_value ` representing JavaScript string.
1812
+ - ` [in] buf ` : Buffer to write the ISO-8859-1-encoded string into. If NULL is
1813
+ passed in, the length of the string (in bytes) is returned.
1814
+ - ` [in] bufsize ` : Size of the destination buffer.
1815
+ - ` [out] result ` : Number of bytes copied into the buffer including the null
1816
+ terminator. If the buffer size is insufficient, the string will be truncated
1817
+ including a null terminator.
1818
+
1819
+ Returns ` napi_ok ` if the API succeeded. If a non-String ` napi_value `
1820
+ is passed in it returns ` napi_string_expected ` .
1821
+
1822
+ This API returns the ISO-8859-1-encoded string corresponding the value passed
1823
+ in.
1824
+
1798
1825
#### * napi_get_value_string_utf8*
1799
1826
<!-- YAML
1800
1827
added: v8.0.0
@@ -1810,14 +1837,14 @@ napi_status napi_get_value_string_utf8(napi_env env,
1810
1837
- `[in] env`: The environment that the API is invoked under.
1811
1838
- `[in] value`: `napi_value` representing JavaScript string.
1812
1839
- `[in] buf`: Buffer to write the UTF8-encoded string into. If NULL is passed
1813
- in, the length of the string (in bytes) is returned.
1840
+ in, the length of the string (in bytes) is returned.
1814
1841
- `[in] bufsize`: Size of the destination buffer.
1815
- - ` [out] result ` : Number of bytes copied into the buffer including the null.
1842
+ - `[out] result`: Number of bytes copied into the buffer including the null
1816
1843
terminator. If the buffer size is insufficient, the string will be truncated
1817
1844
including a null terminator.
1818
1845
1819
- Returns ` napi_ok ` if the API succeeded. Ifa non-String ` napi_value `
1820
- x is passed in it returns ` napi_string_expected ` .
1846
+ Returns `napi_ok` if the API succeeded. If a non-String `napi_value`
1847
+ is passed in it returns `napi_string_expected`.
1821
1848
1822
1849
This API returns the UTF8-encoded string corresponding the value passed in.
1823
1850
@@ -1839,7 +1866,7 @@ napi_status napi_get_value_string_utf16(napi_env env,
1839
1866
passed in, the length of the string (in 2-byte code units) is returned.
1840
1867
- ` [in] bufsize ` : Size of the destination buffer.
1841
1868
- ` [out] result ` : Number of 2-byte code units copied into the buffer including
1842
- the null terminateor . If the buffer size is insufficient, the string will be
1869
+ the null terminator . If the buffer size is insufficient, the string will be
1843
1870
truncated including a null terminator.
1844
1871
1845
1872
Returns ` napi_ok ` if the API succeeded. If a non-String ` napi_value `
0 commit comments