-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add UTF-8 console encoding support for Windows #734
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the contribution, this is wonderful!
Could you take a look at my comment? Is there anything we can do to minimise the side-effectful calls?
if (process.platform === 'win32') { | ||
// Set UTF-8 codepage | ||
require('child_process').execSync('chcp 65001'); | ||
process.stdout.setDefaultEncoding('utf8'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀 I think something like this would belong to a jsNode
block above the definition of println
in libraries/common/effekt.effekt
to ensure that the output of println
itself is UTF-8. Otherwise this line of code only gets interpreted if someone imports console
...
Could you perhaps try to set up your cmd process according to this guide? https://stackoverflow.com/a/57134096 |
sorry was gone the last few days, will try :) |
Since that works, I think that the next move would be to close the PR and update the Getting Started guide in the Windows section :) |
Fixes #726
Problem
When displaying Unicode characters (like chess pieces ♔) on Windows systems, the console shows '?' instead of the actual characters. This works correctly on Linux systems.
I saw the post in the effective programming with effekt course. I had the same problem because I want to create chess with effekt.
Solution
Added Windows-specific console configuration:
chcp
commandNotes
This change only affects Windows systems and has no impact on other platforms.