Skip to content

Add encoding support for markdown documents instead of defaulting to ASCII #16

@ghost

Description

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

Metadata

Metadata

Assignees

Labels

enhancementA request to change or add to current behaviour

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions