Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Severity Level: Warning
Description
This rule detects when an about_ help file doesn't use UTF-8 encoding. The rule verifies that help
files starting with about_ and ending with .help.txt are saved in UTF-8 encoding. It uses the
CurrentEncoding property of the StreamReader class to check the file's encoding.
To ensure your help files use the correct encoding, follow these guidelines:
- When using PowerShell commands to write to files, set the encoding parameter to
utf8,utf8BOM, orutf8NoBOM. - When creating or editing help files in a text editor, configure it to save files in UTF-8 format. Consult your editor's documentation for instructions on setting the file encoding.
Example
Noncompliant
$helpText = @'
TOPIC
about_Contoso
SHORT DESCRIPTION
Describes Contoso commands.
'@
$helpText | Set-Content -Path "about_Contoso.help.txt" -Encoding Unicode
Compliant
$helpText = @'
TOPIC
about_Contoso
SHORT DESCRIPTION
Describes Contoso commands.
'@
$helpText | Set-Content -Path "about_Contoso.help.txt" -Encoding utf8NoBOM
See also
For more information, see the following articles: