spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

Detecting and handling unicode support

Open barrygiles opened this issue 1 year ago • 1 comments

I've read the best practices and various unicode issues in the repo, but I'm still a bit unclear on the best way to handle both unicode and non-unicode consoles.

For example, best practices states that "Windows Terminal supports Unicode". But when I inspect the profile capabilities on this terminal, unicode is set to false.

I can get it to set to true if I put System.Console.OutputEncoding = Encoding.UTF8; at the start of the program and when I do this the output renders perfectly. The problem is that this will then change the encoding for consoles which don't natively support unicode (e.g. cmd) and the rendering is not as good (e.g. rounded panels which don't align instead of a straight border).

I was hoping I could use the unicode capability and then opt in to certain features in code based on this . I.e. set the OutputEncoding only if the encoding capability is true.

barrygiles avatar May 24 '24 15:05 barrygiles

Windows Terminal supports Unicode, but only if the output encoding is unicode. Not really much that can be done about it afaik.

patriksvensson avatar May 24 '24 15:05 patriksvensson