When sending license warning mails to the administrator we do not specify what encoding the text is. If there is any non-ascii characters this is a problem. The text could contain information about cities/locations which could be non-ascii.
Since we create the license files we should encode them in UTF-8 and specify in the email that it is UTF-8 by adding this to the mail header:
> Content-Type: text/plain; charset=UTF-8
We also need to make sure to not open the licence files in the system locale encoding.
Fixed now. Tested the following on Ubuntu20.04 with nightly build 6752:
✓ License warning mail are sent with charset=UTF-8
✓ Sending mail with non-ASCII characters in license file
✓ License with Latin-1 and no charset gives corrupt license file
✓ Get warning mail about expired license file
✓ Get warning mail about too many users
✓ Get log warning about too old ThinLinc version, no mail sent
✓ Valid license gives no warnings
The code changes look good.
I could verify the problem with build 6736, no charset header was included in the warning emails. I can also verified that jenkins build 6757.r36223 works as intended as a "Content-Type: text/plain; charset=UTF-8"-header is included in the emails.
License files with "å" in the agreement description, invalid licenses and duplicate licenses all still work.
Tested on RHEL8. Note that I had to install sendmail and enable that service in order for the warning emails to get sent.