I am using Sandcastle Helpfile Builder to produce a helpfile (.chm). The project is a .shfbproj file, which is XML format, works with msbuild.
I want to automatically update the Footer text that appears in the generated .chm file. I use this snippet:
$newFooter = "<FooterText>MyProduct v1.2.3.4</FooterText>";
get-content -Encoding ASCII $projFile.FullName |
%{$_ -replace '<FooterText>(.+)</FooterText>', $newFooter } > $TmpFile
move-item $TmpFile $projFile.FullName -force
The output directed to the $TmpFile is always a multi-byte string. But I don't want that. How do I set the encoding of the output to ASCII?
>
/Out-File
(but not withSet-Content
) is UTF-16LE (which is part of the Unicode standard and won't go away), not UCS-2 (which is indeed obsolete, because it couldn't represent all Unicode characters). – Streetcar