Skip to content

Problem debugging function with a string parameter to which you send swedish characters in the string #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
johlju opened this issue Mar 3, 2016 · 9 comments

Comments

@johlju
Copy link

johlju commented Mar 3, 2016

A normal function:

function Get-Something
{   [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true,Position=0)]        
        [ValidateNotNullOrEmpty()]       
        [string]$Title
    )

    Write-Verbose $Title    
}

Sending a string with Swedish characters gets a string that is corrupt.
Get-Something -Title "Söder Ögon Åder Råd Rädd" -Verbose
swedishchars

This call doesn't work either since it parses the string wrong.
Get-Something -Title "Ängar" -Verbose
swedishchars2

@rkeithhill
Copy link
Contributor

What file encoding does VSCode indicate for that file? It should be in the status bar on the right side. And what version of VSCode and the PowerShell extension are you on?

@johlju
Copy link
Author

johlju commented Mar 3, 2016

File encoding: UTF-8
VSCode version: 0.10.8
PowerShell extension version: 0.4.1

Also tested on the VSCode Insider version: 0.10.10-insider
Used the same version of PowerShell extension on the Insider version.

@johlju johlju changed the title Problem debugging function with a string paramater to which you send swedish characters in the string Problem debugging function with a string parameter to which you send swedish characters in the string Mar 3, 2016
@daviwil
Copy link
Contributor

daviwil commented Mar 3, 2016

Interesting, I just tried to reproduce this and it works fine for me:

image

This is with the shipped 0.10.8 and 0.4.1 versions of VS Code and the PowerShell extension, respectively.

Can you try to reproduce this issue again and then send the contents of the following file to [email protected]:

c:\Users\<yourusername>\.vscode\extensions\ms-vscode.PowerShell\bin\DebugAdapter.log

@johlju
Copy link
Author

johlju commented Mar 3, 2016

I have sent the requested information.

@johlju
Copy link
Author

johlju commented Aug 1, 2016

This problem still exists in the 1.3.1 version. But I now saw that in the Output pane (when runnig with F8) the problem does not exist. So it seems that the problem are only shown in the debug console. Probably because Output uses PowerShell terminal i guess (?).

image

@johlju
Copy link
Author

johlju commented Aug 1, 2016

OK! Found that when the file has encoding UTF-8 this problem occurs. When the Encoding is UTF-8 with BOM or UTF-16 LE this problem does not occur (only tried with those three encodings).
Below screenshot is from the running the code with file encoding UTF-16 LE.
image

@daviwil
Copy link
Contributor

daviwil commented Aug 4, 2016

Weird! Not sure why it would work with UTF-16 and not with UTF-8. Thanks for the update! We'll keep looking into this.

@lw-schick
Copy link

It would be nice if the plugin would warn when I start writing special chars (f.e. äöü) with UTF8.
As I know it PowerShell does UTF8 only support with BOM. So it would be nice if the plugin could give me a hint here...

@johlju
Copy link
Author

johlju commented Dec 10, 2017

This isn't a problem anymore. I can't reproduce any longer. I guess this started working when we got the PowerShell Integration Console. I forgot about this, and I haven't used Swedish strings in a while so haven't seen it got fixed. 😄

@johlju johlju closed this as completed Dec 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants