How to output unicode in a custom powershell prompt

(Writing this down so I can google it when I inevitably forget about it in the future)

Powershell supports Unicode in a custom prompt, but if it’s coming outĀ garbled, then you probably forgot to save your profile.ps1 as UTF-8 WITH BOM.

 

This is UTF-8 (no BOM):

powershell-unicode-prompt-problem-1

 

 

This is is UTF-8 w/ BOM:

powershell-unicode-prompt-ok-2

Nice.

(BTW, the code for this custom prompt is here)

  • Jose

    Garbled symbols in my customized prompt has been driving me nuts! I’ve been using a boring symbol like ‘>’ for the longest time. Question though, how do I save my profile ps1 file with BOM?

  • Jose

    Nevermind. Figured out how to do it with Notepad++ in the Encoding menu. Thanks!

  • factormystic

    Yep, you’re editor has to know how to do that. You got it.