Skip to content

Unhandled exception output encoding is incorrect in windows console. #4754

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
heroboy opened this issue Jan 19, 2016 · 14 comments
Closed

Unhandled exception output encoding is incorrect in windows console. #4754

heroboy opened this issue Jan 19, 2016 · 14 comments
Labels
windows Issues and PRs related to the Windows platform.

Comments

@heroboy
Copy link

heroboy commented Jan 19, 2016

main.js:

console.log("啊啊啊");
throw new Error("啊啊啊");

output:

c:\Users\VIP\Desktop\PlayNode>node main
啊啊啊
c:\Users\VIP\Desktop\PlayNode\main.js:2
throw new Error("鍟婂晩鍟?);
^

Error: 鍟婂晩鍟?
    at Object.<anonymous> (c:\Users\VIP\Desktop\PlayNode\main.js:2:7)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:134:18)
    at node.js:961:3

c:\Users\VIP\Desktop\PlayNode>
@brendanashworth brendanashworth added the windows Issues and PRs related to the Windows platform. label Jan 19, 2016
@evanlucas
Copy link
Contributor

Seems to be windows-specific. Cannot reproduce on OS X.

啊啊啊
/Users/evan/dev/code/testcases/t.js:2
throw new Error("啊啊啊");
^

Error: 啊啊啊
    at Object.<anonymous> (/Users/evan/dev/code/testcases/t.js:2:7)
    at Module._compile (module.js:397:26)
    at Object.Module._extensions..js (module.js:404:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:429:10)
    at startup (node.js:139:18)
    at node.js:999:3

I want to say there was another issue similar to this...something about colors in an error message. I'll see if I can dig it up.

/cc @nodejs/platform-windows

@evanlucas
Copy link
Contributor

So it looks like https://github.com/nodejs/node/blob/master/deps/v8/src/base/platform/platform-win32.cc#L556 may be what is causing this. More info on OutputDebugStringA can be found at https://msdn.microsoft.com/en-us/library/windows/desktop/aa363362(v=vs.85).aspx. Should this be using OutputDebugStringW?

@evanlucas
Copy link
Contributor

The issue I mentioned earlier is #3734. Seems to be related.

@heroboy
Copy link
Author

heroboy commented Jan 19, 2016

让我来用中文抱怨一句:你妹啊,老子以前的这个issues在joyent那放了几百年没人处理,现在那么快就有反映了,果然开源打法好。

@cjihrig
Copy link
Contributor

cjihrig commented Jan 19, 2016

This could also be related to nodejs/node-v0.x-archive#7940

@Fishrock123
Copy link
Contributor

cc @nodejs/nodejs-cn, could you translate?

@XadillaX
Copy link
Contributor

@Fishrock123 you mean heroboy's reply?

@Fishrock123
Copy link
Contributor

@XadillaX Yeah (Or reply if you can, either way)

@XadillaX
Copy link
Contributor

@Fishrock123

FML, I opened an issue with same question in joyent's node repo hundreds years ago but no one process with it till now. But contributors here proceeded in a few seconds. I must say open sourcing is so awesome.

@seishun
Copy link
Contributor

seishun commented Jan 19, 2016

I'm unable to reproduce this issue on Windows. What's your Node.js version? In which encoding is main.js saved?

@heroboy
Copy link
Author

heroboy commented Jan 20, 2016

@seishun v4.2.1 and main.js saved as utf8.
This is my original issues:nodejs/node-v0.x-archive#7387

@seishun
Copy link
Contributor

seishun commented Jan 20, 2016

Tried it on another computer with plain cmd and Node.js v4.2.1 and couldn't reproduce it.

What's your locale and chcp output?

@heroboy
Copy link
Author

heroboy commented Jan 20, 2016

@seishun I just tired in my home PC, the output is ok,

windows 10, English user interface, Chinese for non-Unicode program, node v5.1.0,
chcp:936

the broken output occurs in my work pc,

windows 8.1, English user interface , Chinese for non-Unicode program, node v4.2.1
chcp:936

@heroboy
Copy link
Author

heroboy commented Feb 15, 2016

hi, I think this issues is duplicated with #3284, and has been fixed.I will close this.
Thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

7 participants