Coder Social home page Coder Social logo

Comments (9)

anseki avatar anseki commented on June 12, 2024

Hi @ciw1973, thank you for the comment.
In Windows, that may be a encoding issue even if the user entered text is correct, because Node.js uses UTF-8 as default.

from readline-sync.

ciw1973 avatar ciw1973 commented on June 12, 2024

Do you have any suggestions to either fix, or work around this?

This is pretty much the simplest possible case, and ideally it should work "out of the box".

from readline-sync.

anseki avatar anseki commented on June 12, 2024

This may help you: #48
Or, these are other information.
https://github.com/anseki/readline-sync/issues?q=is%3Aissue+chcp

from readline-sync.

ciw1973 avatar ciw1973 commented on June 12, 2024

I had looked through the previous issues before creating this ticket, however they all relate to issues with the text of the prompt (UTF-8 being displayed in the console) and my issue is with the user input.

I did try turning on "Beta: Use Unicode UTF-8 for worldwide language support" in Windows, but the result was the following:

image

from readline-sync.

anseki avatar anseki commented on June 12, 2024

For test, write the string data to a file with UTF-8 instead of printing on screen.
And check the file.

from readline-sync.

ciw1973 avatar ciw1973 commented on June 12, 2024

Writing the string returned by readline-sync directly to a file, and opening it in VS Code, shows the same issues as in my original post:

image

The hex for this is:

image

from readline-sync.

anseki avatar anseki commented on June 12, 2024

I see.
readlineSync just only receives string from user and output that, it does nothing to the string.
Therefore maybe you had better choose "Readline" that controls the encoding instead, or another module (e.g. prompts).

from readline-sync.

ciw1973 avatar ciw1973 commented on June 12, 2024

OK, no worries.

from readline-sync.

anseki avatar anseki commented on June 12, 2024

😄

from readline-sync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.