help with encoding

This topic contains 5 replies, has 4 voices, and was last updated by Profile photo of Estudante . Estudante . 1 year, 7 months ago.

  • Author
    Posts
  • #26769
    Profile photo of Estudante .
    Estudante .
    Participant

    Hi.
    I write in the script:

    $a = read-host "Entre com sua opção:
    1)Consultar relatório de servidor
    2)Consultar relatório de pensionista
    3)Consultar relatório de consignatário"

    but the accents don't appear correctly:
    Entre com sua opção:
    1)Consultar relatório de servidor
    2)Consultar relatório de pensionista
    3)Consultar relatório de consignatário:

    what i do?

  • #26770
    Profile photo of Don Jones
    Don Jones
    Keymaster

    The PowerShell console app is not Unicode/DBCS compatible. For characters requiring a double-byte character set, there is no workaround other than to not use those characters. The console app isn't actually PowerShell; it's the Windows console host and it's pretty ancient.

  • #27764
    Profile photo of 庭豐 石
    庭豐 石
    Participant

    Hi Estudante,

    I'm using Win7 with its PowerShell version 2, it works for me. But I suppose it depends on your Windows' locale encoding. For you, I think "Western European" might work. But try to save your script in UTF-16 BE with BOM. Normally, if you use "Windows PowerShell ISE", it would take care of it.

    However, if your Windows' locale is not Western European, I'm afraid that would not work and me too, I'm waiting Microsoft to fix this bug.

    Telling people "... to not use those characters" is so dumb! Sorry to say so. Come on, we are in the 2nd decade of the 21st century and Unicode is still not supported? It's like we're using computer in the 80's. That's so archaic!

    Not only is it dumb to tell people to not use those characters, it's also a lack of respect to others' culture and language.

    Come on Microsoft. Wake up!

  • #27765
    Profile photo of Don Jones
    Don Jones
    Keymaster

    The console app actually dates from the 1980s, and the PowerShell team doesn't "own" it, so they can't fix it. The fix was the PowerShell ISE, which does support Unicode just fine. Unfortunately, the actual console host has a ton of dependencies on it, so it's not easily fixed without a major effort, which thus far Microsoft hasn't made.

    It's nothing to do with a lack of respect on anyone's part. The PowerShell team is well aware of the problem, which is a large part of why the ISE was created.

  • #27778
    Profile photo of Garegin Asatryan
    Garegin Asatryan
    Participant

    as far as I understand they made some improvement to the W32Console in Windows 10. don't know if they solved this one.

  • #28513
    Profile photo of Estudante .
    Estudante .
    Participant

    thanks, my friends.

You must be logged in to reply to this topic.