You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a wired encoding bug with some .psm1 Files in the Output/RequiredModules directory if i had to reinclude them into the repository.
After committing those files the content got scrambled with invisible and strange Unicode characters which broke their functionality
This happened sometimes but not always. In my case the issue was with the DSCBuildHelpers Module.
I found out that the issue only happens if the PowerShell File has UTF16le encoding and the file gets treated as text by git.
Currently the .gitattributes file declares everything as text
and overwrites this for some file extensions.
As far as i understand git uses UTF8 internally and when you commit a file which is configured as text it converts it. After that you'll see the encoding errors.
The git default behaviour for a UTF16le file is to treat it as a binary and that way it stays as it should be.
Other PowerShell files encodings are recognised as text.
Why is this an issue
Sometimes you need a custom version of a required module or you have a niche Azure Dev Ops Server Configuration where you can not use the Azure Dev Ops Artifactory Feed.
Proposal
Remove the everything is text declaration or restrict it to the parts where we are in encoding control like /source/** text eol=autocrlf
Repro Steps
Create a PowerShell File with UTF16 le encoding.
Commit the file
Push the commit
Git clone the repository to a different location
Change the file contents at the different location
Commit and push again
Pull at the original location
The text was updated successfully, but these errors were encountered:
raandree
added a commit
to raandree/DscWorkshop
that referenced
this issue
Dec 4, 2022
* Update azure-pipelines.yml for Azure Pipelines
* Update azure-pipelines.yml for Azure Pipelines
* Fix according to Sampler 0.116.0
* Changed autocrlf scope as suggested in #138
I had a wired encoding bug with some
.psm1
Files in the Output/RequiredModules directory if i had to reinclude them into the repository.After committing those files the content got scrambled with invisible and strange Unicode characters which broke their functionality
This happened sometimes but not always. In my case the issue was with the
DSCBuildHelpers
Module.I found out that the issue only happens if the PowerShell File has UTF16le encoding and the file gets treated as
text
by git.Currently the
.gitattributes
file declares everything as textDscWorkshop/.gitattributes
Line 2 in 29caf18
and overwrites this for some file extensions.
As far as i understand git uses UTF8 internally and when you commit a file which is configured as text it converts it. After that you'll see the encoding errors.
The git default behaviour for a UTF16le file is to treat it as a binary and that way it stays as it should be.
Other PowerShell files encodings are recognised as text.
Why is this an issue
Sometimes you need a custom version of a required module or you have a niche Azure Dev Ops Server Configuration where you can not use the Azure Dev Ops Artifactory Feed.
Proposal
Remove the everything is text declaration or restrict it to the parts where we are in encoding control like
/source/** text eol=autocrlf
Repro Steps
The text was updated successfully, but these errors were encountered: