I have been successfully generating markup files with this module, and started to render them with mkdocs or hugo. Yesterday I noticed that mkdocs wasn't able to render a file due to an encoding problem:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 991: invalid start byte
I took a look at the WriteDocumentContent function and I found that it doesn't specify the -Enconding parameter of Set-Content:
$content | Set-Content -Path $Path;
According to the documentation, the default value for the encoding of Set-Content is ASCII.
My current workaround for this is to specify the -PassThru parameter of Invoke-PSDocument and write the result to disk myself with the correct encoding:
Invoke-PSDocument -Name Test -PassThru | Out-File -FilePath ".\result\Test.md" -Encoding utf8
However, if the default behavior of Invoke-PSDocument is to write content to the disk, it should either be possible to specify the encoding, or the default encoding should not be ASCII
I have been successfully generating markup files with this module, and started to render them with mkdocs or hugo. Yesterday I noticed that mkdocs wasn't able to render a file due to an encoding problem:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 991: invalid start byteI took a look at the
WriteDocumentContentfunction and I found that it doesn't specify the-Encondingparameter ofSet-Content:$content | Set-Content -Path $Path;According to the documentation, the default value for the encoding of Set-Content is ASCII.
My current workaround for this is to specify the
-PassThruparameter ofInvoke-PSDocumentand write the result to disk myself with the correct encoding:Invoke-PSDocument -Name Test -PassThru | Out-File -FilePath ".\result\Test.md" -Encoding utf8However, if the default behavior of
Invoke-PSDocumentis to write content to the disk, it should either be possible to specify the encoding, or the default encoding should not be ASCII