JanDeDobbeleer / oh-my-posh

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

Text encoding broken, path for theme is resolved incorrectly #1619

Closed mwasowski closed 2 years ago

mwasowski commented 2 years ago

Code of Conduct

What happened?

After update to latest version I think text encoding is broken :) obraz

Theme

powerlevel10k_rainbow with minor modifications

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 7.4.0

Segments:

ConsoleTitle(true) -   0 ms -
session(true)  -   0 ms -  * 
path(true)     -   0 ms -   ~ 
git(false)     -  16 ms -
battery(false) -   0 ms -
node(false)    -   0 ms -
shell(true)    -   0 ms -  ﲵ uni 
root(false)    -   0 ms -
text(true)     -   1 ms -  NO CONFIG 
exit(true)     -   0 ms -   

Run duration: 19.7046ms

Cache path: C:\Users\*\AppData\Local/oh-my-posh

Logs:

2022/01/20 09:58:16 getArgs duration: 0s, args:
2022/01/20 09:58:16 getArgs duration: 0s, args:
2022/01/20 09:58:16 getShellName duration: 0s, args:
2022/01/20 09:58:16 debug: getenv

2022/01/20 09:58:16 getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/01/20 09:58:16 isRunningAsRoot duration: 0s, args:
2022/01/20 09:58:16 getShellName duration: 0s, args:
2022/01/20 09:58:16 lastErrorCode duration: 0s, args:
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 getPathSeperator duration: 0s, args:
2022/01/20 09:58:16 getPathSeperator duration: 0s, args:
2022/01/20 09:58:16 getCurrentUser duration: 0s, args:
2022/01/20 09:58:16 getHostName duration: 0s, args:
2022/01/20 09:58:16 getRuntimeGOOS duration: 0s, args:
2022/01/20 09:58:16 templateCache duration: 0s, args:
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 debug: getenv

2022/01/20 09:58:16 getenv duration: 0s, args: SSH_CONNECTION
2022/01/20 09:58:16 debug: getenv

2022/01/20 09:58:16 getenv duration: 0s, args: SSH_CLIENT
2022/01/20 09:58:16 getCurrentUser duration: 0s, args:
2022/01/20 09:58:16 getRuntimeGOOS duration: 0s, args:
2022/01/20 09:58:16 getHostName duration: 0s, args:
2022/01/20 09:58:16 debug: getenv

2022/01/20 09:58:16 getenv duration: 0s, args: POSH_SESSION_DEFAULT_USER
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 getArgs duration: 0s, args:
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 getRuntimeGOOS duration: 0s, args:
2022/01/20 09:58:16 getRuntimeGOOS duration: 0s, args:
2022/01/20 09:58:16 getPathSeperator duration: 0s, args:
2022/01/20 09:58:16 getPathSeperator duration: 0s, args:
2022/01/20 09:58:16 getPathSeperator duration: 0s, args:
2022/01/20 09:58:16 getRuntimeGOOS duration: 0s, args:
2022/01/20 09:58:16 stackCount duration: 0s, args:
2022/01/20 09:58:16 templateCache duration: 0s, args:
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 getRuntimeGOOS duration: 0s, args:
2022/01/20 09:58:16 hasCommand duration: 16.1441ms, args: git.exe
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 error: hasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2022/01/20 09:58:16 hasParentFilePath duration: 0s, args: .git
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 getBatteryInfo duration: 999.1µs, args:
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 getShellName duration: 0s, args:
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 isRunningAsRoot duration: 0s, args:
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 templateCache duration: 0s, args:
2022/01/20 09:58:16 getcwd duration: 0s, args:
2022/01/20 09:58:16 lastErrorCode duration: 0s, args:
2022/01/20 09:58:16 debug: getenv
*
2022/01/20 09:58:16 getenv duration: 0s, args: LOCALAPPDATA
2022/01/20 09:58:16 getCachePath duration: 0s, args:
JanDeDobbeleer commented 2 years ago

@mwasowski please add the following line at the start of your $PROFILE:

$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
mwasowski commented 2 years ago

Ok, that worked. Any idea why this was necessary?

JanDeDobbeleer commented 2 years ago

@mwasowski yes, the config is loaded without UTF-8 support initially so the encoding breaks, even if I would adfjust it to UTF8 as outputencoding would still ruin that.

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.