mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
fix(pwsh): force console to UTF-8 from module
This commit is contained in:
parent
af639a2b7b
commit
5d1cd6209a
|
@ -2,6 +2,18 @@ $env:POSH_PATH = "$((Get-Item $MyInvocation.MyCommand.ScriptBlock.Module.ModuleB
|
||||||
$env:POSH_THEMES_PATH = $env:POSH_PATH + "/themes"
|
$env:POSH_THEMES_PATH = $env:POSH_PATH + "/themes"
|
||||||
$env:PATH = $env:POSH_PATH + [System.IO.Path]::PathSeparator + $env:PATH
|
$env:PATH = $env:POSH_PATH + [System.IO.Path]::PathSeparator + $env:PATH
|
||||||
|
|
||||||
|
if ($ExecutionContext.SessionState.LanguageMode -ne "ConstrainedLanguage") {
|
||||||
|
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
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_MODE = $true
|
||||||
|
}
|
||||||
|
|
||||||
function Get-PoshDownloadUrl {
|
function Get-PoshDownloadUrl {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
if ($ExecutionContext.SessionState.LanguageMode -ne "ConstrainedLanguage") {
|
if ($ExecutionContext.SessionState.LanguageMode -ne "ConstrainedLanguage") {
|
||||||
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
|
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
|
||||||
}
|
}
|
||||||
else {
|
elseif ($env:POSH_CONSTRAINED_LANGUAGE_MODE -ne $true){
|
||||||
Write-Host "[WARNING] ConstrainedLanguage mode detected, unable to set console to UTF-8.
|
Write-Host "[WARNING] ConstrainedLanguage mode detected, unable to set console to UTF-8.
|
||||||
When using PowerShell in ConstrainedLanguage mode, please set the
|
When using PowerShell in ConstrainedLanguage mode, please set the
|
||||||
console mode manually to UTF-8. See here for more information:
|
console mode manually to UTF-8. See here for more information:
|
||||||
|
|
Loading…
Reference in a new issue