array with hebrew chars

This topic contains 3 replies, has 4 voices, and was last updated by Profile photo of Niv Stav Niv Stav 3 years, 7 months ago.

  • Author
  • #11225
    Profile photo of wantto wantto
    wantto wantto

    the array like this :


    for ($i=0; $i -lt $arrOrganizations.length; $i++) {

    the result is :





    instead of



    only after setting setting the regional setting->administrative -> change system local to Hebrew(Israel)

    i get the correct result, what can cause it?

  • #11279
    Profile photo of Don Jones
    Don Jones

    The array is likely storing the characters individually rather than as pairs. Unfortunately, I don't have access to a Hebrew-language system, so I can't test this and confirm.

  • #11290
    Profile photo of Dave Wyatt
    Dave Wyatt

    Are you seeing this problem in the ISE, or only at the PowerShell console? The console subsystem is a pain for this kind of thing; it has no Unicode support and very limited font selection. It sounds like you have the font covered, so you might be able to get away with adding this line at the beginning of your code:

    [Console]::OutputEncoding = [Text.Encoding]::GetEncoding(1255)

    Unfortunately, I don't have a font that displays those characters properly, so I can't really test it.

  • #11353
    Profile photo of Niv Stav
    Niv Stav

    On a Win7 system running PS2 with Hebrew installed, but Non-Unicode set to English US:


    `PS C:\> $arrOrganizations=("??","??");
    PS C:\> for ($i=0; $i -lt $arrOrganizations.length; $i++) {$arrOrganizations[$i]}


    `PS C:\> $arrOrganizations=("א×'","×'ד")
    for ($i=0; $i -lt $arrOrganizations.length; $i++) {$arrOrganizations[$i]}

    Can you tell us what you're running on/with?

You must be logged in to reply to this topic.