PS Studio: weird characters in gridview via exe (not via scipt)

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

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 1 year and 6 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.
Locked
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

PS Studio: weird characters in gridview via exe (not via scipt)

Post by stevens »

Hi,

I have a Powershell Studio project with a gridview box. That works fine but gives weird characters when running the project as exe. As an ps1 it works fine.
Screenshot: https://1drv.ms/u/s!AuBjpW9I3NC4m_8skUS ... g?e=aaiHQd
Or:
What I get, as example (see the ΓÇ and ª characters) :
=> Microsoft Visual C++ 2015-2019 Redistributable (x8ΓÇ ª Microsoft.VC++2015-2019Redist-x86
What I should get:
=> Microsoft Visual C++ 2015-2019 Redistributable (x8… Microsoft.VC++2015-2019Redist-x86

Now I think it is linked to [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
which doesn't work within the exe

Please advise
S
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: PS Studio: weird characters in gridview via exe (not via scipt)

Post by brittneyr »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build:
Operating system:
PowerShell version(s):

*** Please add details and screenshots as needed below. ***

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

Can you please upload your project and psbuild file here:
https://www.sapien.com/support/upload
Brittney
SAPIEN Technologies, Inc.
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

Re: PS Studio: weird characters in gridview via exe (not via scipt)

Post by stevens »

Here is the version info:
Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.166
OS: Windows Server 2016 Standard (64 Bit)
Build: v10.0.14393.0
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

Re: PS Studio: weird characters in gridview via exe (not via scipt)

Post by stevens »

Can't share the project as is now. Don't also see need or added value as it will be useless since it wont generate any extra info for you while not running the project in my environment.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: PS Studio: weird characters in gridview via exe (not via scipt)

Post by Alexander Riedel »

Unfortunately there is not enough information here to evaluate this. Without your files or at the very least a screenshot we cannot determine if you have a GUI project with a grid or if you are using Out-Gridview. A GUI project typically has no console, unless you package it as console application. But we don't know that either without the .psbuild file or some additional information.
We also don't know why or where you change the encoding. A console usually does not use UTF-8, so in order to suggest any workaround more information would be needed.
I will be moving this thread to the PowerShell GUI section.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

Re: PS Studio: weird characters in gridview via exe (not via scipt)

Post by stevens »

Fully agree. That's why I created an example (att.)
example weird character
example weird character
Example01.png (96.91 KiB) Viewed 3040 times
Note that you need Windows 10 and Winget (in Windows 10 Appstore) to make this example work.

This is the output when you just run the code in a Powershell ISE:
ps-ise-workingfine
ps-ise-workingfine
Example02-OK.png (101.09 KiB) Viewed 3039 times
Attachments
Sapien_Example_WeirdCharacters.psf
psf
(15.43 KiB) Downloaded 202 times
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

Re: PS Studio: weird characters in gridview via exe (not via scipt)

Post by stevens »

Any update on this? Can't share more details then I did.
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: PS Studio: weird characters in gridview via exe (not via scipt)

Post by brittneyr »

After further testing, the issue appears to be the results returned when running the following:
SPS_Result_WeirdCharacter.png
SPS_Result_WeirdCharacter.png (93.33 KiB) Viewed 2964 times
ISE_Result_WeirdCharacter.png
ISE_Result_WeirdCharacter.png (123.6 KiB) Viewed 2964 times
You will most likely have to filter out those characters yourself.
Brittney
SAPIEN Technologies, Inc.
This topic is 1 year and 6 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.
Locked