Skip to content

Add JS_NewTwoByteString #1000

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

Merged
merged 1 commit into from
Mar 27, 2025
Merged

Add JS_NewTwoByteString #1000

merged 1 commit into from
Mar 27, 2025

Conversation

bnoordhuis
Copy link
Contributor

Fixes: #992

@Gottox
Copy link
Contributor

Gottox commented Mar 27, 2025

Just browsing the PRs and I must do what every internet user needs to do: Give unqualified opinions. But as this is a public API, it might make sense to comment.

I found the function name not clear. At first reading I thought it was a (somehow strange) optimization of Strings that are two bytes long. I know this under the term 'wide string', which also is reflected in the wchar_t datatype, so JS_NewWideString may make sense here to me.

@saghul
Copy link
Contributor

saghul commented Mar 27, 2025

I believe the name is aligned with how other JS engines name similar things.

@bnoordhuis bnoordhuis merged commit 7891004 into quickjs-ng:master Mar 27, 2025
128 checks passed
@bnoordhuis bnoordhuis deleted the fix992 branch March 27, 2025 18:14
@bnoordhuis
Copy link
Contributor Author

Two-byte is what V8 calls it, deliberately, to make it clear it's not guaranteed to be UTF-16. "Wide" is not clearer, IMO, because how wide?

@chqrlie
Copy link
Collaborator

chqrlie commented Mar 27, 2025

Two-byte is what V8 calls it, deliberately, to make it clear it's not guaranteed to be UTF-16. "Wide" is not clearer, IMO, because how wide?

JS_New16BitString() would be more explicit...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow UTF-16 String access
4 participants