JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
16.73k stars 2.35k forks source link

oh-my-posh.exe not started when path to it contains unicode symbols #1403

Closed IGR2014 closed 2 years ago

IGR2014 commented 2 years ago

Code of Conduct

What happened?

A bug happened!

After installation with WinGet oh-my-posh.exe could not be launched with the following error:

&: The term 'C:/Users/<NAME>/OneDrive/╨Ф╨╛╨║╤Г╨╝╨╡╨╜╤В╤Л/PowerShell/Modules/oh-my-posh/oh-my-posh.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. Invoke-Expression: Cannot bind argument to parameter 'Command' because it is an empty string.

That's happening due to unicode symbols in path (my Windows 11 is russian lang).

So the problem: oh-my-hosh.exe path is detected as "C:/Users//OneDrive/╨Ф╨╛╨║╤Г╨╝╨╡╨╜╤В╤Л/PowerShell/Modules/oh-my-posh/oh-my-posh.exe" But it should be detected as: "C:/Users//OneDrive/Документы/PowerShell/Modules/oh-my-posh/oh-my-posh.exe" (if I launch this manually - it started and I can see OhMyPosh bar)

Windows 11 version: 10.0.22000.348 PowerShell version: 7.2.0 OhMyPosh version: 6.29.1

Theme

It's not even launching

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Write-PoshDebug: The term 'Write-PoshDebug' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
JanDeDobbeleer commented 2 years ago

@IGR2014 how do you install with Winget and end up referencing the PowerShell module?

If you have the PowerShell module, you need to import it first:

Import-Module oh-my-posh

To set PowerShell to UTF-8 (that's a PowerShell issue), add the following line first:

[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
Import-Module oh-my-posh
IGR2014 commented 2 years ago

Just tried to make this run so used couple of information sources on how to install.

Yes, the problem was with PowerShell itself, now everything works with your fix, thanks!

github-actions[bot] commented 6 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.