formulahendry / formulahendry/vscode-code-runner
Issue ÄÜÖ Output view with Code-Runner Extension and UTF8-BOM PS1 File and Powershell [Running] powershell -ExecutionPolicy ByPass -File "e:\Einrichten\test.ps1" Usage and CMD Tools like DSQUERY #137862
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 351
- PR merge metrics
- No merged PRs in 30d
Description
- VS Code Version: Version: 1.62.3 (user setup)
- OS Version: Windows_NT x64 10.0.14393 (German layout and language
- Code Runner Version: v0.11.6
**Describe the bug**
Problem Issue :
If you use in a Powershell Script like DSQUERY the Output in VisualStudio Code with CodeRuner shows follow:
"CN=HH-Gesch�ftsleitung-�ndern,OU=Gesch�ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
Ändern
In Background pocess and write output textfiles it works fine. In standard Configuration the txt files are inUTF-16 LE BOM). PS1 files are in UTF8-BOM.
**To Reproduce**
Steps to reproduce the behavior:
Steps to Reproduce:
1. Install Extenstions:
CodeRunner
Powershell Extension
German language Extension
Set follow in Settings.JSON
```
`
{
"workbench.colorTheme": "Tomorrow Night Blue",
"terminal.integrated.defaultProfile.windows": "PowerShell" ,
"files.encoding": "utf8bom" ,
```
"[powershell]":
{
"files.encoding": "utf8bom",
"files.autoGuessEncoding": true
} ,
"[code-runner.executorMap]":{
"powershell": "pwsh -ExecutionPolicy ByPass -File" ,
"shellLauncher.shells.windows": [
{
"shell": "C:\\Windows\\system32\\cmd.exe",
"label": "cmd"
},
{
"shell": "C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe",
"label": "PowerShell 5.1"
},
],
},}
`
2.
Type and Save file in run.PS1:
: Format of run.PS1 : UTF8 -BOM
```
$Hallo = "Ändern"
#Get-Command
#CHCP 65001
dsquery group -samid HHGeschäftsleitungÄndern | Tee-Object -FilePath E:\result.txt -append
dsquery group -samid HHGeschäftsleitungÄndern
$Hallo
Write-Output "$Hallo" >> E:\Lesen.txt
$Hallo
pause
```
-------------------------------
Result:
In Output View of VisualStudio Code:
```
"CN=HH-Gesch�ftsleitung-�ndern,OU=Gesch�ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
"CN=HH-Gesch�ftsleitung-�ndern,OU=Gesch�ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
�ndern
�ndern
```
-----------------------------------------------------------------------------
And TXT Files (Format UTF-16 LE BOM) :
Result.txt
"CN=HH-Geschäftsleitung-Ändern,OU=Geschäftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
Lesen.txt
Ändern
```
-----------------------------------------------------------------------------------------
Result in Powershell and cmd directly like textfiles.
Run PS1 File in Powershell : Perfect .
Run command in CMD
dsquery group -samid HHGeschäftsleitungÄndern
Runs perfect.
-----------------------------------
Runs in Powershell ISE :
```
PS E:\Einrichten> E:\Einrichten\test.ps1
"CN=HH-Gesch„ftsleitung-Žndern,OU=Gesch„ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
"CN=HH-Gesch„ftsleitung-Žndern,OU=Gesch„ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
Ändern
Ändern
Drücken Sie die Eingabetaste, um den Vorgang fortzusetzen...:
```
dsquery result in txt File
"CN=HH-Gesch„ftsleitung-Žndern,OU=Gesch„ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
-------------------------------------------
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Changing Configuration of run.PS1 to
```
```
[Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8
$PSDefaultParameterValues['*:Encoding'] = 'utf8'
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
$Hallo = "Ändern"
dsquery group -samid HHGeschäftsleitungÄndern | Tee-Object -FilePath E:\result.txt -append
dsquery group -samid HHGeschäftsleitungÄndern
$Hallo
Write-Output "$Hallo" >> E:\Lesen.txt
$Hallo
```
pause
```
[Running] powershell -ExecutionPolicy ByPass -File "e:\Einrichten\test.ps1"
"CN=HH-Gesch�ftsleitung-�ndern,OU=Gesch�ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
"CN=HH-Gesch�ftsleitung-�ndern,OU=Gesch�ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
Ändern
Ändern
------------------------------
Results (UTF8 BOM) :
result.txt:
"CN=HH-Gesch�ftsleitung-�ndern,OU=Gesch�ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
Lesen.txt
Ändern
-------------------------------------------------
Powershell ISE:
"CN=HH-Gesch„ftsleitung-Žndern,OU=Gesch„ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
--------
Powershell direct. :
Output
"CN=HH-Gesch�ftsleitung-�ndern,OU=Gesch�ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
"CN=HH-Geschäftsleitung-Ändern,OU=Geschäftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
Ändern
Ändern
Drücken Sie die Eingabetaste, um den Vorgang fortzusetzen...:
txt
"CN=HH-Gesch�ftsleitung-�ndern,OU=Gesch�ftsleitung,OU=Hamburg,DC=Deutschland,DC=AG"
----
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.