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

I/O incorrectly assumes a Unicode terminal #43673

Closed
zzo38 opened this issue Jul 3, 2022 · 3 comments
Closed

I/O incorrectly assumes a Unicode terminal #43673

zzo38 opened this issue Jul 3, 2022 · 3 comments

Comments

@zzo38
Copy link

zzo38 commented Jul 3, 2022

Version

v6.11.0

Platform

Linux zzo38computer 3.2.0-87-generic #125-Ubuntu SMP Fri Jun 19 08:25:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

  • Set LANG=C and a non-Unicode terminal.

  • Input non-Unicode text in the REPL, or using the readline interface (the example in the documentation is suitable to reproduce this bug).

  • Enter strings with escapes in the REPL such as "\x8A" or "\x9A".

  • (I don't know what console.table does, since I do not have that version of Node.js.)

How often does it reproduce? Is there a required condition?

If the locale and/or terminal emulator is not Unicode, e.g. set the environment variable LANG=C.

What is the expected behavior?

My suggestions are:

  • The problem with input probably cannot be fixed for the REPL. (But, for the readline function, this could be made an option.)

  • For output in the REPL, check for a non-Unicode locale and always display escaped codes in that case, like it already does for ASCII control codes. (This also improves security in the case of homoglyphs, etc; this way, you can change the locale if you are concerned about such a thing.)

  • For output using console.log, the existing behaviour is probably acceptable; if you need non-Unicode output then you can use the other functions to output instead, so probably this does not need to be fixed.

What do you see instead?

  • Input in the REPL that does not match the input that I typed (it replaces my input with a Unicode replacement character, which is then displayed incorrectly).

  • Broken output (if it contains any non-ASCII characters and is not being redirected to a file).

  • (I do not know what console.table does, since I do not have that version of Node.js)

Additional information

The locale will not always be Unicode; you should not incorrectly assume that it is.

@mscdex
Copy link
Contributor

mscdex commented Jul 3, 2022

node 6.x has been unsupported for a very long time. Have you tried with a modern, supported version of node?

@juanarbol
Copy link
Member

node 6.x has been unsupported for a very long time. Have you tried with a modern, supported version of node?

I agree with this; is this issue reproducible in a supported version?

@bnoordhuis
Copy link
Member

Closing, no follow-up.

@bnoordhuis bnoordhuis closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2022
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

4 participants