Option for Duktape to use UTF-16 internally
See original GitHub issueMany major JavaScript engines use UTF-16, both internally and in their API. This makes it difficult to write a generic abstraction that also works with Duktape, as these engines expose strings through their API as wchar_t* instead of char*. Consider adding an option to use UTF-16 for the internal representation instead of UTF-8.
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (16 by maintainers)
Top Results From Across the Web
How to work with non-BMP characters - (o) Duktape Wiki
The main choice is between: Using surrogate pairs: standard approach, engine neutral, has some inconveniences like .length of strings counting the surrogate ...
Read more >JavaScript's internal character encoding: UCS-2 or UTF-16?
Does JavaScript use UCS-2 or UTF-16 encoding? Since I couldn't find a definitive answer to this question anywhere, I decided to look into...
Read more >What factors make PHP Unicode-incompatible? - Stack Overflow
The question is: How are strings stored internally? If I type in "Währung" or "Écriture", which Encoding is used to create the bytes...
Read more >A small but complete JavaScript engine - Hacker News
QuickJS is quite a pleasure to work with, for variety of reasons. Not using setjmp/longjmp and having a nice internal resource leak ...
Read more >Program Post-Release Updates - Learning Python
For more encoding-conversion options, see savesUseKnownEncoding in ... In UTF-16, the general 'utf-16' always both discards a BOM on input and adds one...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@denisdemaisbr Yes, one solution is to encode/code strings as needed. @fatcerberus’s request was for Duktape to do that automatically (either using an internal representation in UTF-16, or providing an automatic conversion on demand).
Current approach is to use WTF-8 as internal representation which can be 1:1 mapped to UTF-16 as needed. Closing this one.