Powershell: Out-file – Filesize is double

I have been struggling with my powershell script , i write a content variable to a file using Out-File

$data.jar_cookie_content | Out-File -FilePath $cookie_file

What’s wrong with this? i checked the output file using the text editor , they look exactly the same content of the variable.

Initially, i thought the problem is from my other program , some ow it doesn’t accept this data. After 1/2 day troubleshooting i realized the filesize was double than its original content.

I finally fixed it with this:

$data.jar_cookie_content | Out-File -FilePath $cookie_file -encoding ASCII

Leave a Reply

Your email address will not be published. Required fields are marked *