vscode-powershell: French characters are not displayed correctly when debugging

System Details Output

- Operating system name and version : Windows 10 Version 10.0.17763 Numéro 17763
- VS Code version  : 1.30.1
- PowerShell extension version : 1.10.2
- Output from `$PSVersionTable`
### VSCode version: 1.30.1 dea8705087adb1b5e5ae1d9123278e178656186a x64

### VSCode extensions:
hbenl.vscode-firefox-debug@1.7.3
heaths.vscode-guid@1.4.0
MS-CEINTL.vscode-language-pack-fr@1.30.2
ms-vscode.csharp@1.17.1
ms-vscode.PowerShell@1.10.2
msjsdiag.debugger-for-chrome@4.11.1
robertohuertasm.vscode-icons@8.0.0


### PSES version: 1.10.2.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.17763.134
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.134
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1



<!-- PowerShell output from above goes here -->


Issue Description

I am experiencing a problem with French characters wich are not correctly reproduced on VS Integrated console but it may also apears with any special characters from any language.

Expected Behaviour

When I type the following command directly in the console everything is displayed correctly. write-host “---- These are french characters : âà ç éèë ïï and they are not correctly displayed ----”

image

Actual Behaviour

But if I use the powershell extension and type the same command in a .ps1 file encoded in UTF8 I have this incorrect result :

image

Attached Logs

Follow the instructions in the troubleshooting docs about capturing and sending logs.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16

Most upvoted comments

Unfortunately, I can’t do that. If I use UTF8 in ISE/VSCODE/NPP for example, all hell breaks loose at execution: variables contaning accented characters break, display strings too.

That’s because without the BOM PowerShell defaults to CP-1252. If you set PowerShell to use UTF-8, that shouldn’t happen:

$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding

In PowerShell 6+, it should default to UTF-8 anyway and you won’t hit any of these problems out of the box.