question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option for Duktape to use UTF-16 internally

See original GitHub issue

Many 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:closed
  • Created 6 years ago
  • Comments:18 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
svaaralacommented, Sep 1, 2017

@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).

0reactions
svaaralacommented, Apr 8, 2022

Current approach is to use WTF-8 as internal representation which can be 1:1 mapped to UTF-16 as needed. Closing this one.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found