au icon indicating copy to clipboard operation
au copied to clipboard

Allow setting character encoding on report file

Open sumo300 opened this issue 3 years ago • 1 comments

Report creation should allow setting what character encoding to use for writing the file (i.e. UTF-8).

There is currently an issue when using Azure DevOps to upload a markdown report as a build summary as it requires either UTF-8 or Text. During the pipeline, if the file is attempted to be changed to the correct encoding and written back to the same file, errors occur because the file is locked. There is a workaround in that the contents of the original report can be written to a different file, but it would be far easier if there was a property to set the encoding of the report.

sumo300 avatar Feb 11 '22 21:02 sumo300

Doing some further investigation into this issue. This is specifically affecting Azure DevOps (ADO) which requires a UTF-8 or Text file attached as a markdown report for its summary task (the markdown then shows up in a tab for viewing when a build completes).

The issue seems to arise when using Microsoft's hosted ADO agents (Windows 2019 right now) as the PowerShell sessions on that host is set to UTF-16 LE (little endian) and therefore the report file written uses that encoding.

To ensure any host is supported, the current encoding would need to be detected, then used to re-write the file to UTF-8.

Thus the need for an option to be added to provide the encoding desired for the report output file.

sumo300 avatar Feb 14 '22 16:02 sumo300