I have a Windows agent plugin in Powershell which Outputs special characters. It works on the Powershell and ISE but refuses to encode them correctly in the Agent. The following example
Write-Host '<<<encoding_test:sep(9)>>>'
Write-Host 'Hello ä é ô'
results in the agent output
<<<encoding_test:sep(9)>>>
Hello „ ‚ “
The agent seems to do some magic with utf16 to utf8 conversion, however this does not help here, the output is not encoded correctly. Does anyone has a idea how to solve this?
I have solution for you
The powershell file must be saved with encoding “UTF-8 with BOM” and you need to use an encoding setting in the header line. Like the following example
Write-Host('<<<encoding_test:sep(9):encoding(cp437)>>>')
Write-Host('Test ÄÖÜ - Hello ä é ô')
Output on the monitoring system looks like this.
I think the most important part is the “cp437” codepage and the format of your powershell script with “UTF-8 with BOM”