Is there any way to write something like this in Powershell? (Linux would be with Perl)
char foo = '\x41';
I need to input some non-printable characters to one of my programs
I’d like to offer a different approach than casting as hex. Instead of using hex, PowerShell 7 supports Unicode character encoding (see article about_special_characters > Unicode characters). So, with x041 as Latin capital A, the Unicode equivalent would be "`u{41}"
. The Microsoft docs example demonstrated with this example: "`u{2195}"
(note the backtick precedes the letter).