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

An abnormal output occurs when the String.fromCharCode method is called #5226

Open
ayuan0828 opened this issue Mar 7, 2025 · 1 comment
Open

Comments

@ayuan0828
Copy link

Description

When the "string.fromcharcode" method is called, if the argument is assigned to 0, it should output an invisible empty String, but it actually outputs·\0000 .

Version

v3.0.0

Testcase

var str1 = String.fromCharCode(0);
print(str1);

Output

\u0000
@kasperisager
Copy link

kasperisager commented Mar 28, 2025

The current behavior is correct; the NULL byte is escaped when printed. Firefox does the same when printing strings and it's incredibly helpful for spotting unexpected code points.

Image

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

No branches or pull requests

2 participants