docs: explain PowerShell 5 encoding (#11662)

This commit is contained in:
Joshua Powers 2022-08-11 15:46:02 -06:00 committed by GitHub
parent 0fe374e9f1
commit 64c85eb4f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -24,6 +24,22 @@ telegraf config --input-filter cpu:mem:net:swap --output-filter influxdb:kafka
[View the full list][flags] of Telegraf commands and flags or by running `telegraf --help`. [View the full list][flags] of Telegraf commands and flags or by running `telegraf --help`.
### Windows PowerShell v5 Encoding
In PowerShell 5, the default encoding is UTF-16LE and not UTF-8. Telegraf
expects a valid UTF-8 file. This is not an issue with PowerShell 6 or newer,
as well as the Command Prompt or with using the Git Bash shell.
As such, users will need to specify the output encoding when generating a full
configuration file:
```sh
telegraf.exe config | Out-File -Encoding utf8 telegraf.conf
```
This will generate a UTF-8 encoded file with a BOM. However, Telegraf can
handle the leading BOM.
## Configuration Loading ## Configuration Loading
The location of the configuration file can be set via the `--config` command The location of the configuration file can be set via the `--config` command