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

Non UTF-8 Data Corruption #6

Open
NuSkooler opened this issue Dec 28, 2015 · 1 comment
Open

Non UTF-8 Data Corruption #6

NuSkooler opened this issue Dec 28, 2015 · 1 comment

Comments

@NuSkooler
Copy link

Overview
Non UTF-8 data is corrupted by the time it gets to the data listener.

Example
Use ptyw.js to spawn DOSEMU or QEMU + FreeDOS under CentOS 7 using their virtual serial ports. From there, launch something that outputs ANSI graphics (I am duplicating this launching DOS BBS doors such as L.O.R.D.). This will produce CP437 data being sent to the serial port -> stdio -> ptyw.js. It cannot be decoded as such, however.

If you launch the same applications directly from the terminal using cp437 decoding (e.g. using https://github.com/keaston/cp437) the data is decoded properly.

EDIT: Updated from data learned in second comment.

@NuSkooler
Copy link
Author

Sorry for all the updates, but I think I found the problem. Nothing to do with termios, but the setEncoding on the stream @ https://github.com/iiegor/ptyw.js/blob/master/lib/pty.js#L125 (and others)

This assumes data is UTF-8, which is certainly not always the case. Omitting it, and letting the consumer's data listener take care of encodings works. I had made this modificaiton on my ElementaryOS and Windows boxes but had a clean checkout on CentOS 7.

@NuSkooler NuSkooler changed the title Data corruption on CentOS 7 Non UTF-8 Data Corruption Dec 28, 2015
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

1 participant