none
displaying unicode characters in the powershell console

    Question

  • Anyone know the exact commands to get this script to display correctly in the powershell console (not the ISE)?  I've tried following different links, but haven't had any luck.


    $Test = '♭'  # (U+266D)
    $Test

    • Edited by JS2010 Friday, May 24, 2019 10:10 PM
    Friday, May 24, 2019 9:58 PM

All replies

  • What script?  What is not displaying?

    The character is not a good Unicode character in PS. 

     [char]0x266D


    \_(ツ)_/

    Friday, May 24, 2019 10:51 PM
    Moderator
  • The symbol does not exist in the Microsoft character set.  You have to find a character set where it is defined.


    \_(ツ)_/

    Friday, May 24, 2019 11:01 PM
    Moderator
  • I've found that it works with these fonts: MS Gothic, NSimSun, SimSum-ExtB.  Although Lucida Console and Consolas work in the ISE.  Although $outputencoding is set in the ISE to "system.text.sbcscodepageencoding".  When I try that in the console, it can't find the type.

    Friday, May 24, 2019 11:10 PM
  • Hi,

    Thanks for your question.

    When I change the font to NSimSun in PowerShell console, I found this character can be display correctly.

    Best regards,

    Lee


    Just do it.

    Monday, May 27, 2019 2:52 AM
    Moderator