mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
chore(pwsh): warm user we're unable to set the console to UTF-8
relates to #1100
This commit is contained in:
parent
dbee7edde7
commit
3c3da5e9df
|
@ -109,6 +109,26 @@ SAVEHIST=10000
|
||||||
setopt appendhistory
|
setopt appendhistory
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### PowerShell: Running in ConstrainedLanguage mode
|
||||||
|
|
||||||
|
You're here because you've seen the following message:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
[WARNING] ConstrainedLanguage mode detected, unable to set console to UTF-8.
|
||||||
|
When using PowerShell in ConstrainedLanguage mode, please set the
|
||||||
|
console mode manually to UTF-8. See here for more information:
|
||||||
|
https://ohmyposh.dev/docs/faq#powershell-running-in-constrainedlanguage-mode
|
||||||
|
```
|
||||||
|
|
||||||
|
When running PowerShell in ConstrainedLanguage mode, we can't set the console to UTF-8. This will cause the prompt to be rendered incorrectly.
|
||||||
|
There's a few [options][utf-8] to set the console to UTF-8 from an OS perspective on Windows, other systems shouldn't be impacted.
|
||||||
|
|
||||||
|
To remove the message after manual configuration, you can add the following to your `$PROFILE` before importing oh-my-posh:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$env:POSH_CONSTRAINED_LANGUAGE = 1
|
||||||
|
```
|
||||||
|
|
||||||
[new-issue]: https://github.com/JanDeDobbeleer/oh-my-posh/issues/new
|
[new-issue]: https://github.com/JanDeDobbeleer/oh-my-posh/issues/new
|
||||||
[latest]: https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest
|
[latest]: https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest
|
||||||
[wt-glyph]: https://github.com/microsoft/terminal/issues/3546
|
[wt-glyph]: https://github.com/microsoft/terminal/issues/3546
|
||||||
|
@ -119,3 +139,4 @@ setopt appendhistory
|
||||||
[upgrading]: upgrading.md
|
[upgrading]: upgrading.md
|
||||||
[wt-vim]: https://github.com/microsoft/terminal/issues/3794
|
[wt-vim]: https://github.com/microsoft/terminal/issues/3794
|
||||||
[vim-wt]: https://github.com/vim/vim/issues/5092
|
[vim-wt]: https://github.com/vim/vim/issues/5092
|
||||||
|
[utf-8]: https://github.com/PowerShell/PowerShell/issues/7233#issuecomment-640243647
|
||||||
|
|
|
@ -5,7 +5,16 @@
|
||||||
|
|
||||||
# Powershell doesn't default to UTF8 just yet, so we're forcing it as there are too many problems
|
# Powershell doesn't default to UTF8 just yet, so we're forcing it as there are too many problems
|
||||||
# that pop up when we don't
|
# that pop up when we don't
|
||||||
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
|
if ($ExecutionContext.SessionState.LanguageMode -ne "ConstrainedLanguage") {
|
||||||
|
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
|
||||||
|
} elseif ($env:POSH_CONSTRAINED_LANGUAGE -ne 1) {
|
||||||
|
Write-Host "[WARNING] ConstrainedLanguage mode detected, unable to set console to UTF-8.
|
||||||
|
When using PowerShell in ConstrainedLanguage mode, please set the
|
||||||
|
console mode manually to UTF-8. See here for more information:
|
||||||
|
https://ohmyposh.dev/docs/faq#powershell-running-in-constrainedlanguage-mode
|
||||||
|
"
|
||||||
|
$env:POSH_CONSTRAINED_LANGUAGE = 1
|
||||||
|
}
|
||||||
|
|
||||||
function Get-PoshCommand {
|
function Get-PoshCommand {
|
||||||
if ($IsMacOS) {
|
if ($IsMacOS) {
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
# Powershell doesn't default to UTF8 just yet, so we're forcing it as there are too many problems
|
# Powershell doesn't default to UTF8 just yet, so we're forcing it as there are too many problems
|
||||||
# that pop up when we don't
|
# that pop up when we don't
|
||||||
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
|
if ($ExecutionContext.SessionState.LanguageMode -ne "ConstrainedLanguage") {
|
||||||
|
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
|
||||||
|
} elseif ($env:POSH_CONSTRAINED_LANGUAGE -ne 1) {
|
||||||
|
Write-Host "[WARNING] ConstrainedLanguage mode detected, unable to set console to UTF-8.
|
||||||
|
When using PowerShell in ConstrainedLanguage mode, please set the
|
||||||
|
console mode manually to UTF-8. See here for more information:
|
||||||
|
https://ohmyposh.dev/docs/faq#powershell-running-in-constrainedlanguage-mode
|
||||||
|
"
|
||||||
|
}
|
||||||
$env:POWERLINE_COMMAND = "oh-my-posh"
|
$env:POWERLINE_COMMAND = "oh-my-posh"
|
||||||
$env:CONDA_PROMPT_MODIFIER = $false
|
$env:CONDA_PROMPT_MODIFIER = $false
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue