How can I encode the Unicode character U+0048 (H), say, in a PowerShell string?
In C# I would just do this: "\u0048"
, but that doesn't appear to work in PowerShell.
How can I encode the Unicode character U+0048 (H), say, in a PowerShell string?
In C# I would just do this: "\u0048"
, but that doesn't appear to work in PowerShell.
Replace '\u' with '0x' and cast it to System.Char:
You can also use the "$()" syntax to embed a Unicode character into a string:
Where T is PowerShell's representation of the character for non-registered trademarks.
Maybe this isn't the PowerShell way, but this is what I do. I find it to be cleaner.
According to the documentation, PowerShell Core 6.0 adds support with this escape sequence:
see https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-6#unicode-character-ux