-
Notifications
You must be signed in to change notification settings - Fork 7
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
Emojis not visible even in unicode-supported terminal #46
Comments
SpectreConsole checks terminal capabilities on import and sets a profile. try running this before you import the module. $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = [System.Text.UTF8Encoding]::new() i could replicate your issue in my extension terminal, i had forgot to set UTF8 in my vscode profile. after setting that and restarting the terminal emojis worked. if it still doesn't work, could you share the output of the below command? & (gmo PwshSpectreConsole) { Get-SpectreProfile } |
That does fix it! Interesting. Would it be worth autodetecting some terminals we know have unicode support and enable this? E.g. Windows Terminal can be detected with WT_PROFILE_ID env variable EDIT: Related: PowerShell/PowerShell#7233 |
yea showing a warning on import if someone isn't running utf8 would probably save a few people some headache. I'm not sure changing someones codepage would be nice? there are some edge cases around WSL and similar that dont mix too well with UTF8. But utf8 should just be the default one by now... also at the point we could detect it Spectre has already set the profile.. and it does not appear to be entirely straightforward to force it to utf8 after the fact.. but i've only done some brief tests, maybe there is a way to get it to re-run "discovery". |
Yeah I'd say warning with a ENV variable or global setting to suppress it is probably the way to go. |
I've been hoping windows terminal just bites the bullet and sets this. The annoying part is you need to include that snippet as the very first thing in the profile to avoid any other command generating output before setting the encoding settings. When I've got some time to tinker I think I'll update the module to detect this and maybe offer something like these options on the first run:
I avoided touching peoples encoding settings originally but it's kind of so odd to have to set up that it might be worth it. |
PS> pwsh -nop -c 'ipmo .\PwshSpectreConsole\PwshSpectreConsole\PwshSpectreConsole.psd1'
WARNING: Your session is currently using encoding 'OEM United States', this disables certain functionality as SpectreConsole requires UTF8 encoding, consider adding
'$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = [System.Text.UTF8Encoding]::new()' to your $profile
to suppress this warning set the environment variable '$env:IgnoreSpectreEncoding=$true'
Note: this needs to be set before importing the module
this covers the basics atleast. it'll be in once #50 is merged. |
… expose sixel support test function
PWSH 7.4, Windows Terminal, also happens in vscode. PwshSpectreConsole 2.1.1
The text was updated successfully, but these errors were encountered: