Unsupported Encoding when building exe

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
daniel kusnir
Posts: 40
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Thu May 25, 2017 8:22 am

Unsupported Encoding when building exe

Post by daniel kusnir »

Hello

since i cannot reopen old topic, i have to start new one.


i updated my Windows OS to latest build, and now i have same issue as described here in topic here :
Error: Unsupported file encoding (Unicode Big Endian)

I changed to every possible encoding, however i still end up with same result.

Issue happens for all WinForms, old or new.


------ Build started: ChildTest, Configuration: x64 ------
Packaging with SAPIEN PowerShell V5 Host (Windows Forms) x64
Adding C:\Users\Daniel\OneDrive\SAPIEN\PowerShell Studio\Projects\RunSpace\ChildTest.Package.ps1
Error: Unsupported file encoding (Unicode Big Endian)


PS Version : 173

User avatar
Alexander Riedel
Posts: 7344
Joined: Tue May 29, 2007 4:43 pm

Re: Unsupported Encoding when building exe

Post by Alexander Riedel »

Please check what your default file encoding is in PowerShell Studio.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
daniel kusnir
Posts: 40
Joined: Thu May 25, 2017 8:22 am

Re: Unsupported Encoding when building exe

Post by daniel kusnir »

default is UTF-8-BOM

but i tested every encoding, the result is all the same

User avatar
daniel kusnir
Posts: 40
Joined: Thu May 25, 2017 8:22 am

Re: Unsupported Encoding when building exe

Post by daniel kusnir »

i just reinstalled from 171 to 5.7.175 on different machine, i started to experience same behavior :

Error: Unsupported file encoding (Unicode Big Endian)

this is for all projects that i already built. Default is still UTF-8-BOM

when i create brand new project, packages got compiled, however all other projects are unusable now.

Any idea how to fix that ?

The only output i see is :

------ Build started: ShowTsVar, Configuration: x64 ------
Packaging with SAPIEN PowerShell V2 Host (Windows Forms) x64
Adding C:\Users\Daniel\OneDrive\SAPIEN\PowerShell Studio\Projects\ShowTsVar\Production\White\ShowTsVar.Package.ps1
Error: Unsupported file encoding (Unicode Big Endian)

However i do not see more specific log which form or script is causing the issue. I manually check all, but every script in the project has same encoding

User avatar
daniel kusnir
Posts: 40
Joined: Thu May 25, 2017 8:22 am

Re: Unsupported Encoding when building exe

Post by daniel kusnir »

sorry i made a typo -

1. when i create new multi-form project, i got exactly same issue
2. when i crate new form only, i do not see any issues

User avatar
brittneyr
Site Admin
Posts: 432
Joined: Thu Jun 01, 2017 7:20 am

Re: Unsupported Encoding when building exe

Post by brittneyr »

The default encoding is the encoding used for 'new' script files, it does not change the encoding of existing files. To change the encoding of an existing file, open the file in PowerShell Studio, update the encoding on the status bar (bottom-right corner), and save:
SPS_Encoding.png
SPS_Encoding.png (17.89 KiB) Viewed 258 times
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
daniel kusnir
Posts: 40
Joined: Thu May 25, 2017 8:22 am

Re: Unsupported Encoding when building exe

Post by daniel kusnir »

Encoding for my existing or new projects has not been changed. It is a default as it always been.

I tried to change it and tested all options you have, however the result is still the same. Is there a way to get some verbose log where exactly is the issue ? i tested 2 PCs, both have same issue when updated to 175

User avatar
daniel kusnir
Posts: 40
Joined: Thu May 25, 2017 8:22 am

Re: Unsupported Encoding when building exe

Post by daniel kusnir »

All right i solved the issue. Microsoft posted here: https://docs.microsoft.com/en-us/powers ... wershell-7

a little code to re-encode ps1 file. So i had ran the script and it fixed my issue. All my projects are compilable again and
i can use latest version at last.
  1. $path = cd "my path to the script directory"
  2.  
  3. Get-ChildItem *.ps1 -Recurse | ForEach-Object {
  4.  
  5.     $content = Get-Content -Path $_
  6.  
  7.     Set-Content -Path $_.Fullname -Value $content -Encoding UTF8 -PassThru -Force
  8.  
  9. }