{"id":335,"date":"2016-05-18T20:31:01","date_gmt":"2016-05-19T01:31:01","guid":{"rendered":"http:\/\/factormystic.net\/blog\/?p=335"},"modified":"2020-06-22T21:32:30","modified_gmt":"2020-06-23T02:32:30","slug":"how-to-output-unicode-in-a-custom-powershell-prompt","status":"publish","type":"post","link":"https:\/\/factormystic.net\/blog\/how-to-output-unicode-in-a-custom-powershell-prompt","title":{"rendered":"How to output unicode in a custom powershell prompt"},"content":{"rendered":"<p>(Writing this down so I can google it when I inevitably forget about it in the future)<\/p>\n<p>Powershell supports Unicode in a custom prompt, but if it&#8217;s coming out\u00a0garbled, then you probably forgot to save your profile.ps1 as <em>UTF-8 WITH BOM<\/em>.<\/p>\n<p>&nbsp;<\/p>\n<p>This is UTF-8 (no BOM):<\/p>\n<p><a href=\"https:\/\/factormystic.net\/blog\/wp-content\/uploads\/2016\/05\/cap1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-336\" src=\"https:\/\/factormystic.net\/blog\/wp-content\/uploads\/2016\/05\/cap1.png\" alt=\"powershell-unicode-prompt-problem-1\" width=\"316\" height=\"218\" srcset=\"https:\/\/factormystic.net\/blog\/wp-content\/uploads\/2016\/05\/cap1.png 316w, https:\/\/factormystic.net\/blog\/wp-content\/uploads\/2016\/05\/cap1-300x206.png 300w\" sizes=\"auto, (max-width: 316px) 100vw, 316px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>This is is UTF-8 w\/ BOM:<\/p>\n<p><a href=\"https:\/\/factormystic.net\/blog\/wp-content\/uploads\/2016\/05\/cap2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-337\" src=\"https:\/\/factormystic.net\/blog\/wp-content\/uploads\/2016\/05\/cap2.png\" alt=\"powershell-unicode-prompt-ok-2\" width=\"316\" height=\"218\" srcset=\"https:\/\/factormystic.net\/blog\/wp-content\/uploads\/2016\/05\/cap2.png 316w, https:\/\/factormystic.net\/blog\/wp-content\/uploads\/2016\/05\/cap2-300x206.png 300w\" sizes=\"auto, (max-width: 316px) 100vw, 316px\" \/><\/a><\/p>\n<p>Nice.<\/p>\n<p>(BTW, the code for this custom prompt is <a href=\"https:\/\/gist.github.com\/factormystic\/87cdd8d9887911e23a36435fe97a006d\">here<\/a>)<\/p>\n<p>[embedGist source=&#8221;https:\/\/gist.github.com\/factormystic\/87cdd8d9887911e23a36435fe97a006d&#8221;]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(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&#8217;s coming out\u00a0garbled, then you probably forgot to save your profile.ps1 as UTF-8 WITH BOM. &nbsp; This is UTF-8 (no BOM): &nbsp; &nbsp; This is is UTF-8 w\/ BOM: [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,35,7],"tags":[],"class_list":["post-335","post","type-post","status-publish","format-standard","hentry","category-powershell","category-unicode","category-windows-stuff"],"_links":{"self":[{"href":"https:\/\/factormystic.net\/blog\/wp-json\/wp\/v2\/posts\/335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/factormystic.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/factormystic.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/factormystic.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/factormystic.net\/blog\/wp-json\/wp\/v2\/comments?post=335"}],"version-history":[{"count":3,"href":"https:\/\/factormystic.net\/blog\/wp-json\/wp\/v2\/posts\/335\/revisions"}],"predecessor-version":[{"id":416,"href":"https:\/\/factormystic.net\/blog\/wp-json\/wp\/v2\/posts\/335\/revisions\/416"}],"wp:attachment":[{"href":"https:\/\/factormystic.net\/blog\/wp-json\/wp\/v2\/media?parent=335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/factormystic.net\/blog\/wp-json\/wp\/v2\/categories?post=335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/factormystic.net\/blog\/wp-json\/wp\/v2\/tags?post=335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}