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
    Posts
  • #11225
    Profile photo of wantto wantto
    wantto wantto
    Participant

    the array like this :

    $arrOrganizations=("×'ד","א×'");

    for ($i=0; $i -lt $arrOrganizations.length; $i++) {
    $arrOrganizations[$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
    Keymaster

    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
    Moderator

    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
    Participant

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

    Console:

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

    ISE:

    `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.