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.
This topic is 3 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
daniel kusnir
Posts: 75
Last visit: Tue May 23, 2023 10:50 am
Answers: 1

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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

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: 75
Last visit: Tue May 23, 2023 10:50 am
Answers: 1

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: 75
Last visit: Tue May 23, 2023 10:50 am
Answers: 1

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: 75
Last visit: Tue May 23, 2023 10:50 am
Answers: 1

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: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

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 2003 times
Brittney
SAPIEN Technologies, Inc.
User avatar
daniel kusnir
Posts: 75
Last visit: Tue May 23, 2023 10:50 am
Answers: 1

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: 75
Last visit: Tue May 23, 2023 10:50 am
Answers: 1

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. Get-ChildItem *.ps1 -Recurse | ForEach-Object {
  3.     $content = Get-Content -Path $_
  4.     Set-Content -Path $_.Fullname -Value $content -Encoding UTF8 -PassThru -Force
  5. }
This topic is 3 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.