I\'m trying to write a script to search the contents of a file, and when it comes across a grouping of ASCII control characters, to insert a CR/LF.
The pattern of ch
Michael Sorens' helpful answer explains the problem with your approach well and offers a working solution.
To offer a simpler alternative:
$CR = ([char[]] (3, 0, 2, 3, 1)) -join ''
3, 0, 2, 3, 1 creates an array of integers with the Unicode code points of the characters to create.
Cast [char[]] converts the code points to actual characters ([char]).
-join '' joins the array of characters (with no separator) to for a single string.