Closed crazycrank closed 2 years ago
@crazycrank that's because PowerShell and UTF-8 is real pain. To fix that, please init oh-my-posh in UTF-8, we have to do the same in other places ourselves as well. One day they will fix this....
$previousOutputEncoding = [Console]::OutputEncoding
try {
[Console]::OutputEncoding = [Text.Encoding]::UTF8
oh-my-posh init pwsh --config D:\testü\custom.omp.json | Invoke-Expression
} finally {
[Console]::OutputEncoding = $previousOutputEncoding
}
This worked, thanks a lot.
A more general question, since you sound like you have some experience on the topic. Is there a reason to not keep the encoding at UTF-8?
@crazycrank yes, as PowerShell isn't yet fully UTF8, the functionalities of certain CLI tools isn't guaranteed. But mostly, it doesn't impact much looking at EU systems. Asian locale's however usually break.
Hey Jan - I tried this, I'm not sure if I have the syntax right or not. See the two screenshots.
@akulbe 9/10 it's the backslashes being interpreted as escape sequences. Try replacing those with forward slashes.
No dice. I switched from \
to /
file-wide. Same result.
If this helps… https://gist.github.com/akulbe/ec5565557c263f82eefce6c6eb6e328b it's my $PROFILE
@akulbe what's the output of oh-my-posh.exe init pwsh --config "C:/Users/Aaron Kulbe/AppData/Local/Programs/oh-my-posh/themes/powerline.omp.json"
?
@akulbe you seem to have a really old version of oh-my-posh installed. Can you validate that there's no duplicate old installation somewhere? Because that output has been removed a long time ago (and would explain the issue as well). Did you perhaps migrate from the module?
That must have been it. I used Revo Uninstaller Pro to scan, and there was some leftover cruft. Reinstalled from winget
, and now it's working as expected.
Thank you both for your time, and your help!!
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.
Code of Conduct
What happened?
When trying to apply a custom theme which is located in a directory using special chars, in my case mutated vowels like äöü (but i guess other chars as well), the profile does not get applied.
oh-my-posh init pwsh --config D:\testü\custom.omp.json | Invoke-Expression
--> Nothing happens
oh-my-posh init pwsh --config D:\testu\custom.omp.json | Invoke-Expression
--> The theme gets applied
Theme
{ "blocks": [ { "alignment": "left", "type": "prompt", "segments": [ { "background": "#ffe9aa", "foreground": "#100e23", "powerline_symbol": "\ue0b0", "style": "powerline", "template": " \uf0e7 ", "type": "root" }, { "background": "#ffffff", "foreground": "#100e23", "powerline_symbol": "\ue0b0", "style": "powerline", "type": "time" }, { "background": "#91ddff", "foreground": "#100e23", "powerline_symbol": "\ue0b0", "properties": { "folder_icon": "\uf115", "folder_separator_icon": " \ue0b1 ", "style": "full" }, "style": "powerline", "template": " {{ .Path }} ", "type": "path" }, { "type": "git", "style": "powerline", "powerline_symbol": "\uE0B0", "foreground": "#193549", "background": "#95ffa4", "background_templates": [ "{{ if or (.Working.Changed) (.Staging.Changed) }}#fff38c{{ end }}", "{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ff645e{{ end }}", "{{ if gt .Ahead 0 }}#b388ff{{ end }}", "{{ if gt .Behind 0 }}#f5a15d{{ end }}" ], "template": " {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uF044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uF046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uF692 {{ .StashCount }}{{ end }}", "properties": { "fetch_status": true, "fetch_stash_count": true, "fetch_upstream_icon": true, "untracked_modes": { "/Users/user/Projects/oh-my-posh/": "no" } } }, { "background": "#906cff", "foreground": "#100e23", "powerline_symbol": "\ue0b0", "style": "powerline", "template": " \ue235 {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{ end }}{{ .Full }}{{ end }} ", "type": "python" }, { "background": "#ff8080", "foreground": "#ffffff", "powerline_symbol": "\ue0b0", "style": "powerline", "template": " \ue20f ", "type": "exit" } ] }, { "alignment": "left", "type": "prompt", "newline": true, "segments": [ { "foreground": "#007ACC", "style": "plain", "template": "\u276f ", "type": "text" } ] } ], "version": 2 }
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Log output