deno-cliffy
deno-cliffy copied to clipboard
Broken special character encoding on Windows Terminal
Windows Terminal supports emoji:
deno run https://deno.land/std/examples/welcome.ts
However, cliffy Prompt with emoji prints garbled output instead
import { Input } from "https://deno.land/x/cliffy/prompt/mod.ts";
const name: string = await Input.prompt( {message: `What's your name?`, pointer: '🦕' } );
deno run --unstable https://gist.githubusercontent.com/prcdpr/a202eabe338fc47bcc5e1c80b987f974/raw/39ac37c59ad0efc8bb7b03b02225e7eaafde5bd7/cliffy-prompt-emoji.ts
Code gist to test can be found here https://gist.github.com/prcdpr/a202eabe338fc47bcc5e1c80b987f974
Hi @prcdpr,
there is an issue with Deno.stdout.write
which doesn't handle unicode characters well. There is already an deno issue https://github.com/denoland/deno/issues/6001.
But i found a workaourund here https://github.com/denoland/deno/issues/6131#issuecomment-640032166.
You have to enable utf8 character encoding in windows than it should work.
Thanks for finding this. I don't like the solution mentioned as it requires system restart, but following can also be done (copying my another answer):
[Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8
To keep this setting persistent, you can create a %userprofile%/Documents/PowerShell/profile.ps1
with the line above.
Reopening because this is still an issue.
Looks like this is now fixed.