Inproper encoding?

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Joshua Leichtman Joshua Leichtman 2 years, 3 months ago.

  • Author
    Posts
  • #17981
    Profile photo of Joshua Leichtman
    Joshua Leichtman
    Participant

    Paste this into Powershell Prompt (or ISE) and Char returns "å". Save this as a .ps1 file and executing it and it returns "A¥".

    ~~~~
    $Char = "å"
    $Char
    ~~~~

    I've tried swathing the encoding but nothing I have tried has worked so far. It doesn't make sense why PowerShell.exe handles this any differently then a script does.

    Any ideas???

  • #17982
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    There are two possibilities that I can think of, off the top of my head. The encoding of your file might not support that character properly, or, if you're using PowerShell.exe, the console encoding might also be a problem. (Do you get the same results if you run the script from the ISE? It has full unicode support for the console pane.)

  • #17983
    Profile photo of Joshua Leichtman
    Joshua Leichtman
    Participant

    I'm running the script in the same window I'm manually inputting the $Char = "å".

    Do you have the same problem if you put the two lines into a script vs pasting it into PowerShell.exe?

    Joshua

You must be logged in to reply to this topic.