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

Encoding problems with umlauts in logged exception messages #3284

Closed
bergus opened this issue Oct 8, 2015 · 5 comments
Closed

Encoding problems with umlauts in logged exception messages #3284

bergus opened this issue Oct 8, 2015 · 5 comments
Labels
confirmed-bug Issues with confirmed bugs. windows Issues and PRs related to the Windows platform.

Comments

@bergus
Copy link

bergus commented Oct 8, 2015

I have the following simple script:

"use strict";
console.log("üÜäÄöÖß")
console.error("üÜäÄöÖß");
throw new Error("üÜäÄöÖß"); // or alternatively:
console.assert(false, "üÜäÄöÖß"); // throws AssertionError

which when executed logs the following:

üÜäÄöÖß
üÜäÄöÖß

c:\Users\….js:4
throw new Error("├╝├£├ñ├ä├Â├û├ƒ");
      ^
Error: ├╝├£├ñ├ä├Â├û├ƒ
    at Object.<anonymous> (c:\Users\….js:4:7)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

It seems the global exception handler does not use the appropriate output encoding, while console does.
It doesn't seem to make any difference whether I encode my script as UTF8 or anything else - the first two logs are fine, but the error message is not.

Admittedly, I'm still on node v0.10.30. Would an update help?

@silverwind
Copy link
Contributor

Confirming on Windows 7. Setting cmd to unicode with chcp 65001 seems to fix it. Still a bug imho, as console does it right.

@silverwind silverwind added confirmed-bug Issues with confirmed bugs. windows Issues and PRs related to the Windows platform. labels Oct 8, 2015
@mscdex
Copy link
Contributor

mscdex commented Oct 8, 2015

It should be noted it displays as expected in the REPL at least.

@silverwind
Copy link
Contributor

I assume REPL goes through libuv, while errors such as above are printed directly from C++.

@mscdex
Copy link
Contributor

mscdex commented Oct 8, 2015

I have a fix coming soon...

@silverwind
Copy link
Contributor

Ack!

mscdex added a commit to mscdex/io.js that referenced this issue Oct 13, 2015
The printf family of functions do not properly display UTF8
strings well on Windows. Use the appropriate wide character
API instead if stderr is a tty.

Fixes: nodejs#3284
@mscdex mscdex closed this as completed in 2d35607 Oct 13, 2015
mscdex added a commit that referenced this issue Oct 28, 2015
The printf family of functions do not properly display UTF8
strings well on Windows. Use the appropriate wide character
API instead if stderr is a tty.

PR-URL: #3288
Fixes: #3284
Reviewed-By: Bert Belder <[email protected]>
mscdex added a commit that referenced this issue Oct 29, 2015
The printf family of functions do not properly display UTF8
strings well on Windows. Use the appropriate wide character
API instead if stderr is a tty.

PR-URL: #3288
Fixes: #3284
Reviewed-By: Bert Belder <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

3 participants