qetza / replacetokens-task

Azure Pipelines task to replace tokens in files with variables.
MIT License
11 stars 2 forks source link

utf-16le files are corrupt after token replace (V6) #27

Closed petertheautomator closed 4 months ago

petertheautomator commented 4 months ago

We upgraded replacetokens from V4 to V6 and all UTF-16le files that are processed become corrupted.

How to replicate

error in the example: image

Settings:

- task: replacetokens@6
    displayName: "Replace tokens"
    inputs:
      sources: filles/task.xml
      missingVarLog: 'error'
      transforms: true
      telemetryOptout: true
qetza commented 4 months ago

Hi @petertheautomator, One breaking change in v6 is that the default value from addBom (previously writeBOM) is now false instead of true which is causing your issue.

With the following settings it will work:

- task: replacetokens@6
    displayName: "Replace tokens"
    inputs:
      sources: filles/task.xml
      addBOM: true
      missingVarLog: 'error'
      transforms: true
      telemetryOptout: true
petertheautomator commented 4 months ago

addBOM: true fixed the problem. Thanks for the quick response!