Here's an example I came up with. I'm not sure how to make it work.
Program.cs:
using System;
using System.Text;
namespace myApp
{
class Program
{
static void Main(string[] args)
{
Byte[] byteOrderMark;
byteOrderMark = Encoding.Unicode.GetPreamble();
//Console.OutputEncoding = new UnicodeEncoding(false, true);
Console.OutputEncoding = System.Text.Encoding.Unicode;
Console.WriteLine("Hello World!");
}
}
}
$env:path += ';C:\Windows\Microsoft.NET\Framework64\v4.0.30319'
csc Program.cs
# no output for either
.\Program | select-string Hello
.\Program | select-string Hello -encoding unicode
# no 'FF FE' BOM
.\program | Format-Hex
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000 48 00 65 00 6C 00 6C 00 6F 00 20 00 57 00 6F 00 H.e.l.l.o. .W.o.
00000010 72 00 6C 00 64 00 21 00 r.l.d.!.
If you want to bother searching for the nulls between each letter:
.\program | select-string h`0e
H e l l o W o r l d !
It still seems to me like using utf8 and the powershell ise is the best option, even with windows terminal being available.