Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: added napi_get_value_string_latin1 #14678

Closed
wants to merge 2 commits into from

Conversation

kfarnung
Copy link
Contributor

@kfarnung kfarnung commented Aug 7, 2017

  • Reordered string functions alphabetically
  • Fixed a typo in napi_get_value_string_utf8

Ref: #14256
Fixes: #14397

Checklist
Affected core subsystem(s)

doc, n-api

* Reordered string functions alphabetically
* Fixed a typo in napi_get_value_string_utf8
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. node-api Issues and PRs related to the Node-API. labels Aug 7, 2017
Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I have a question though. What is the motivation for truncating instead of returning something like ENOBUFS in napi_get_value_string_latin1(). Is there ever a case where the truncated value is preferred?

@kfarnung
Copy link
Contributor Author

kfarnung commented Aug 7, 2017

@cjihrig I'll let others say for sure, but from what I've seen this is consistent behavior with other string APIs (including the V8 ones). Admittedly I've gone back and forth myself as to whether it's the right behavior, but it seems pretty common.

doc/api/n-api.md Outdated
- `[in] str`: Character buffer representing a UTF16-LE-encoded string.
- `[in] length`: The length of the string in two-byte code units, or -1 if
it is null-terminated.
- `[in] str`: Character buffer representing a latin1-encoded string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I’d spell it as Latin-1 and/or say that it’s ISO-8859-1, I think most developers know it under that latter name.

@kfarnung
Copy link
Contributor Author

Thanks @addaleax, I noticed a couple more typos and fixed them as well.

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@refack
Copy link
Contributor

refack commented Aug 14, 2017

Copy link
Member

@TimothyGu TimothyGu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This suggestion only applies to V8. If this isn't the case for other supported VMs
then I'm happy for this PR to be landed as is.

- `[out] result`: A `napi_value` representing a JavaScript String.

Returns `napi_ok` if the API succeeded.

This API creates a JavaScript String object from a UTF16-LE-encoded C string
This API creates a JavaScript String object from a ISO-8859-1-encoded C string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For V8 at least, the text doesn't have to be ISO-8859-1. "String encoded using a one-byte encoding" is perhaps more accurate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TimothyGu huh? V8 does interpret that string as ISO-8859-1. We do use the …OneByte… methods in core for that encoding, and that’s what the V8 docs say (which, granted, I wrote, but also did pass review. 😄).

@tniessen
Copy link
Member

Landed in e96b949.

@tniessen tniessen closed this Aug 16, 2017
tniessen pushed a commit that referenced this pull request Aug 16, 2017
* Reordered string functions alphabetically
* Fixed a typo in napi_get_value_string_utf8

PR-URL: #14678
Fixes: #14397
Refs: #14256
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
@kfarnung kfarnung deleted the napi_docs branch August 16, 2017 20:09
MSLaguana pushed a commit to nodejs/node-chakracore that referenced this pull request Aug 21, 2017
* Reordered string functions alphabetically
* Fixed a typo in napi_get_value_string_utf8

PR-URL: nodejs/node#14678
Fixes: nodejs/node#14397
Refs: nodejs/node#14256
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
MylesBorins pushed a commit that referenced this pull request Sep 10, 2017
* Reordered string functions alphabetically
* Fixed a typo in napi_get_value_string_utf8

PR-URL: #14678
Fixes: #14397
Refs: #14256
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Sep 10, 2017
MylesBorins pushed a commit that referenced this pull request Sep 12, 2017
* Reordered string functions alphabetically
* Fixed a typo in napi_get_value_string_utf8

PR-URL: #14678
Fixes: #14397
Refs: #14256
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this pull request Apr 10, 2018
* Reordered string functions alphabetically
* Fixed a typo in napi_get_value_string_utf8

PR-URL: nodejs#14678
Fixes: nodejs#14397
Refs: nodejs#14256
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 16, 2018
* Reordered string functions alphabetically
* Fixed a typo in napi_get_value_string_utf8

Backport-PR-URL: #19447
PR-URL: #14678
Fixes: #14397
Refs: #14256
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. node-api Issues and PRs related to the Node-API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

napi_get_value_string_latin1 not mentioned in N-API docs