|Component||Checks & Agents|
|Title||Linux agent: Fix possible encoding issues of Python plugins|
|Checkmk Edition||Checkmk Raw Edition (CRE)|
|Compatibility||Compatible - no manual interaction needed|
In previous versions the agent was not setting the encoding information in the environment, making Python plugins fail with UnicodeEncodeError exceptions when executed through the agent.
Confusingly, the same command has often worked in interactive debugging, since the interactive shells of the users have set the encoding correctly
The Linux agent is now setting LC_ALL to C.utf8 (in case the locale is available on the monitored system) instead of only LC_ALL=C.
When the encoding is not set in the environment, Python will encode all the output written to stdout/stderr with ANSI_X3.4-1968. This will fail when there are non-ASCII characters in the output. Once the encoding is set, Python can detect it and encode all output using UTF-8.